View Full Version : Navigating through forms

03-23-2005, 06:19 AM
I have three forms of which the second is presented only after the first one is filled and similarly, the third is presented after the second is filled.
Now my problem is that I do not want to enter the details in the database unless all three are filled correctly.
So can you tell me a way of storing the data of the first form somwhere before the second is visited ?Also I may need to reload the first form as is if the user clicks on 'back to first' ?

I think a way to do it is to pass all the data to the second jsp page through the 'action' in the form.But is there any better way to do it?
Please help me with it.


03-23-2005, 12:21 PM
My solution would be to do form pagination on the client side: www.klproductions.com/klslideshow.html
You can do client-side data verification as user goes through "pages" and your server will handle the validation of the complete form.
If JS is disabled/unavailable/insufficient the user will be presented with one long form (while less convinient it is still accessible).

03-23-2005, 06:37 PM

Code just to explain the idea not tested.

function storeFormVars(formObj){
var elements=formObj.elements;
for(var i=0;i<elements.length;i++){

Now your navigator variable will have all the form values. And its scope is across all pages within the window. So you can use this to store form1 values, go to form2, then come back again to form1 and restore values or continue to form3.

Have fun :)