Xtremer360 Posted January 13, 2011 Share Posted January 13, 2011 One more question for the day. I'm trying to figure out the best way to run about this. Right now I have it set up so that two or more content pages CAN NOT have the same name or shortname as it performs checks to verify that there aren't both on my add new and edit pages. Now problem here is that say I'm on the edit form and I'm editing a content page with its dropdowns and what not in the form. Now I'm thinking what would be the next course of option because what if I only want to change one dropdown but still keep the same name and shortname. When I submit it, its going to kickback my response that it can't be saved because there's already a page in there with that name and shortname even though I didn't change it. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/224330-editing-form/ Share on other sites More sharing options...
Eiolon Posted January 13, 2011 Share Posted January 13, 2011 It depends on how you are validating, but what I normally do in this situation, is I create two separate forms. They are physically on the same page as each other, but I'll keep the name exclusive to FORM 1 with it's own submit button and I will put the rest of the information in FORM 2 with it's own submit button. You just need to make the presentation obvious to the user that it is two separate forms and that clicking the update button only updates their respective forms. Quote Link to comment https://forums.phpfreaks.com/topic/224330-editing-form/#findComment-1159023 Share on other sites More sharing options...
Xtremer360 Posted January 13, 2011 Author Share Posted January 13, 2011 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/224330-editing-form/#findComment-1159027 Share on other sites More sharing options...
Psycho Posted January 13, 2011 Share Posted January 13, 2011 There is a much simpler solution in my opinion. You only need one form to both create and update the "pages". Just include a hidden field in the form for the id of the form being edited. When the user chooses to edit a page, populate the ID in that hidden field. When the user selects the option to create a new page, the field will not have a value. Now, when the user submits the form, check if the ID field has a value - if so, then you know they are editing an existing page. If not, then they are trying to create a new page. Quote Link to comment https://forums.phpfreaks.com/topic/224330-editing-form/#findComment-1159029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.