Re: Best Practice - Forms
For most of my forms I used something like this for my SQL: IF EXISTS(Select Username From USERS where username= '#form.username#') Update Stuff ELSE Insert stuff This way if the user does go back to correct something (so long as it isn't the username). The form will update upon resubmit. Adam H On Wed, 28 Jul 2004 15:38:17 -0400, Tangorre, Michael [EMAIL PROTECTED] wrote: Right after your initial insert set a session variable containing the some kind of ID to the record. Before you do another insert, check to see if the session var exists and if so, use an update query instead with the ID in the var... Mike The problem I have run into in the past is that a user will submit a form, then see the results (confirmation page) and need to make a change, hit the back button, and end up creating record #2 instead of updating the original record. So, in this case, how do you make the second pass on the form actual perform an update operation instead of an insert? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Best Practice - Forms
You could also generate the ID for the record on the page where they enter data, and pass it to the page that processes it.This way, you can first see if the record exists (yes = update, no = create).You may end up with IDs that get selected and not used, but such is life. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Best Practice - Forms
I have done it before storing the entire form contents into a session variable, but storing the record ID might be simpler.I will have to think about this one some more. Thanks for all of the feedback. -- Jeff Quoting Tangorre, Michael [EMAIL PROTECTED]: Right after your initial insert set a session variable containing the some kind of ID to the record. Before you do another insert, check to see if the session var exists and if so, use an update query instead with the ID in the var... Mike The problem I have run into in the past is that a user will submit a form, then see the results (confirmation page) and need to make a change, hit the back button, and end up creating record #2 instead of updating the original record. So, in this case, how do you make the second pass on the form actual perform an update operation instead of an insert? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Best Practice - Forms
I have dealt with this in a variety of different ways in the past, I am wanted to see how other people did it.I have a form.This same form is reused for creating a new record as well as updating an existing record. So, the question is how do people 'control' the back button and the case where the user submits the form, backs up, and resubmits it again?In the case of a create operation, the first time the form is displayed it would be empty, but upon reloading the form, it would contain the original data and would now be an update operation.In the case of an update operation, the first time the form is displayed, it would contain the current data, but upon reloading the form, it would contain the updated data and still be an update operation (would go to an update query instead of an insert). So, what are your best practices for handling form input and reusing a form? Thanks -- Jeff [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Best Practice - Forms
I am not sure what you are actually asking ... Questions back at you: 1) Are you concerned with someone who inserts a form and hitting their back button only to get the form again without anything in it or an EXPIRED page? 2) Or are you asking if someone goes into a page where they are updating information, and then hits refresh?Wouldn't it just refresh the page and the data from the db? Maybe I am missing something on your original post. Paul Giesenhagen QuillDesign - Original Message - From: Jeff Chastain To: CF-Talk Sent: Wednesday, July 28, 2004 1:33 PM Subject: Best Practice - Forms I have dealt with this in a variety of different ways in the past, I am wanted to see how other people did it.I have a form.This same form is reused for creating a new record as well as updating an existing record. So, the question is how do people 'control' the back button and the case where the user submits the form, backs up, and resubmits it again?In the case of a create operation, the first time the form is displayed it would be empty, but upon reloading the form, it would contain the original data and would now be an update operation.In the case of an update operation, the first time the form is displayed, it would contain the current data, but upon reloading the form, it would contain the updated data and still be an update operation (would go to an update query instead of an insert). So, what are your best practices for handling form input and reusing a form? Thanks -- Jeff [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Best Practice - Forms
The problem I have run into in the past is that a user will submit a form, then see the results (confirmation page) and need to make a change, hit the back button, and end up creating record #2 instead of updating the original record. So, in this case, how do you make the second pass on the form actual perform an update operation instead of an insert? Thanks -- Jeff Quoting Paul Giesenhagen [EMAIL PROTECTED]: I am not sure what you are actually asking ... Questions back at you: 1) Are you concerned with someone who inserts a form and hitting their back button only to get the form again without anything in it or an EXPIRED page? 2) Or are you asking if someone goes into a page where they are updating information, and then hits refresh?Wouldn't it just refresh the page and the data from the db? Maybe I am missing something on your original post. Paul Giesenhagen QuillDesign - Original Message - From: Jeff Chastain To: CF-Talk Sent: Wednesday, July 28, 2004 1:33 PM Subject: Best Practice - Forms I have dealt with this in a variety of different ways in the past, I am wanted to see how other people did it.I have a form.This same form is reused for creating a new record as well as updating an existing record. So, the question is how do people 'control' the back button and the case where the user submits the form, backs up, and resubmits it again?In the case of a create operation, the first time the form is displayed it would be empty, but upon reloading the form, it would contain the original data and would now be an update operation.In the case of an update operation, the first time the form is displayed, it would contain the current data, but upon reloading the form, it would contain the updated data and still be an update operation (would go to an update query instead of an insert). So, what are your best practices for handling form input and reusing a form? Thanks -- Jeff [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Best Practice - Forms
Right after your initial insert set a session variable containing the some kind of ID to the record. Before you do another insert, check to see if the session var exists and if so, use an update query instead with the ID in the var... Mike The problem I have run into in the past is that a user will submit a form, then see the results (confirmation page) and need to make a change, hit the back button, and end up creating record #2 instead of updating the original record. So, in this case, how do you make the second pass on the form actual perform an update operation instead of an insert? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]