Closed Thread Icon

Topic awaiting preservation: Problem with Display:None and Back Button (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=8632" title="Pages that link to Topic awaiting preservation: Problem with Display:None and Back Button (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Problem with Display:None and Back Button <span class="small">(Page 1 of 1)</span>\

 
snips
Nervous Wreck (II) Inmate

From:
Insane since: Apr 2003

posted posted 05-01-2003 17:32

I'm using the document.frm.text.style.display="" technique to hide/display form controls based on which radio button the user clicks.

If the user submits the form, which has required fields. If the user misses a required field they hit the back button the form fields are invisible again, since the onload sets the display to none. The user then has to reclick the radio button for them to be displayed (which the user wouldn't know to do).

I want the fields hidden when the form first loads, and the fields are displayed when the user clicks the radio button. Is there a way to make it so when the user backs up it will display any form fields that were displayed before the form is submitted?

I have tried setting a cookie or setting a session (its a coldfusion page, if that helps) but I have found that when the user hits the back button the page isn't really reloading, so it uses the values that were passed when the page was first loaded, hence the onload set to display none.

Anyone know how to have the page change the display based upon the value of the radio button?


Thanks!

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-01-2003 17:39

snips: I suspect you are working along the right lines:

quote:
I have tried setting a cookie or setting a session (its a coldfusion page, if that helps) but I have found that when the user hits the back button the page isn't really reloading, so it uses the values that were passed when the page was first loaded, hence the onload set to display none.



but you want to stop the caching of the page with the forms in that way you should be able to reload a 'new' page which detects the cookies. You could stop them using the back button by displaying the fields on the 'whoops you missed one' page with the relevant fields filled in and the one requiring input highlighted (you can then do all the required showing and hiding too). This is probably a better soluion anyway

___________________
Emps

FAQs: Emperor

snips
Nervous Wreck (II) Inmate

From:
Insane since: Apr 2003

posted posted 05-09-2003 16:06

I took your suggestion and just passed all the fields as hidden in the form and then when the user misses a required field, I gave them a link to complete the form. As long as they hit the BIG button I gave them, the page displays correctly and enters the hidden fields as the display.

If they hit the back button they are on their own... (I haven't found any solution to the show/hide problem with the back button...so I am just making it easier to hit the button I created, rather than to hit the back button.

Thanks for the suggestion

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-09-2003 17:04

I have a suggestion, it's not a great one since IE takes two hits of refresh to properly re-retrieve the page from the server, but how about if you put a javascript refresh/reload function in the head of the form page, that way when the user visits the page for the first time it will load normally (maybe a slight delay), but when the user hits the back button to go back to this page it will also force a reload and maybe that would defeat the dreaded cache problem. Also, have you tried using the 'dont' cache meta tags? not hugely reliable but may help:

quote:
**TAKEN FROM A WEB PAGE**

<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

Above META tags should be placed in between your <HEAD> and </HEAD> tags. Also note that the specified date should be a date in the past so that the browser will immediately discard the cached copy or not cache it at all.

Why use two tags you ask? Although "Expires" tag is properly handled by most browsers, some older browsers may still look for the "no-cache" tag. If you're not worried about users with old browsers, using the "Expires" tag alone is sufficient and will make it possible to specify the exact time to expire content.



[This message has been edited by smonkey (edited 05-09-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu