Jump to content

Editing form


Xtremer360

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.