I have a form with a predisplayed line item number, in this
case 1, to start off. There is a checkbox to add another line item,
so if they check the box and fill out the form and submit, it
brings up the form again with line item 2 (continuous increment by
1 if the box is checked). If they fill out the form again and do
not check the add another line item box, the form submits and goes
to another page with a popup message indicating a successful
transaction.
Here is the problem. On the message page, if they hit the
back button on the browser, it goes back to the form, with line
item 2 (which was already submitted). If they submit again, line
item 2 will be written to the table again, and there can only be
one line item.
If I make the line item a unique key in the table, the
application will just blowup. Can it display a nice error message
about duplicate line items ?
My other option would be to use javascript to disable the
back button, but everyone says that is not recommened.
If that is the case, what do I do to avoid this situation ?
The sequence of events/screens works properly, but as soon as
they use the back button, that is where I run into problems.