Page 1 of 1
Retaining HTML form values when going "back" a pag
Posted: Mon Jan 19, 2004 4:09 am
by andyhough
Hi all,
A quick question... I have setup an online application form that allows users' to apply for jobs online to my current company. When they submit the form it checks a few fields for validation. If these are incorrect then there is an option to go back and change these values (using the javascript back browser command). When the screen goes back it loses all the HTML values in the form and the user has to start again. This wouldn't be too much of a problem on a small form but this would take about 30-45mins to fill out so needless to say i need to solve this one
Any help would be appreciated guys, i have searched the forums and cannot really find a viable solution at this time.
Thanks in advance
Andy

Posted: Mon Jan 19, 2004 4:14 am
by lazersam
This is just off the top of my head... what about adding the "value=" statement in the form field and starting up session variables that can carry the info back to the original page? I havent tried it with the "java back".
Just a passing thought.
Posted: Mon Jan 19, 2004 4:30 am
by andyhough
If you mean setting each form value=$value i have tried this and it doesn't seem to work
I've tried registering the Globals on the page too but nothing i attempt appears to work.. hmmm
Good one this
Cheers anyway

Posted: Mon Jan 19, 2004 5:01 am
by JayBird
why do the users have to "go back", that is just annoying, why not just show the form again and highligh the fields that were incorrect/missing.
Mark
Posted: Mon Jan 19, 2004 5:25 am
by andyhough
could do, could do.. but i would still like to know how this is done if anyone has any suggestions just for the point of knowing it for the future. I don't want to avoid doing something just because i don't know how to do it. You may be right in the way the form should go over itself but i want to also know how to retain values for future reference anyway.
Thanks for the suggestion though

Posted: Mon Jan 19, 2004 5:29 am
by JayBird
there isn't a solution!
Read this
http://www.experts-exchange.com/Web/Web ... 38517.html
I think it is client dependent.
Mark
Posted: Mon Jan 19, 2004 5:35 am
by andyhough
I thought this too, although it does seem to work with some forms available on the Internet. (not using the same page technique).
surely there is a way. I know there is a meta tage called "no-cache". Can this be reversed maybe so it caches the page values?
Posted: Mon Jan 19, 2004 8:43 am
by andyhough
I have managed to solve the problem now. Just for the record it is possible. I added the following lines above my page:
session_cache_limiter("public");
header("Cache-control: private");
This seemed to force the page into holding the values in the fields.
Thanks for everyone's help though, much appreciated

Posted: Mon Jan 19, 2004 9:20 am
by JayBird
i wouldn't rely on it tho
set steps and save data
Posted: Mon Jan 19, 2004 10:01 am
by djot
-
hi,
my solution was to first of all not rely on java(<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>)script and (turned off!?)cookies.
I did add an id (session, token) whatever you call it to my action=url in the form. (may be input type=hidden also for sure)
this token is saved to a database with the current step being performed. Now you can save each step and related data to the database. now you are able to able to go back, read out the data from step x (previous, same, first etc.) out of the db and put it back into the form. It's a lot of work, so i won't do that for too many forms. better find an an intelligent object related solution for many forms/steps.
djot