Radio Button Caching Issue

O

onlystuff

Hi

Using the following code

<form id="form1" name="form1" method="post" action="">
<input name="radiobutton" type="radio" value="radiobutton"
id="radiobutton" />
<label for="radiobutton">Radio Button One</label>

<input name="radiobutton" type="radio" value="radiobutton"
id="radio" />
<label for="radio">Radio Button Two</label>

</form>

if I preview the page in Firefox, make a selection then hit refresh,
Firefox remembers my choice. I want it start over as if the form is
empty and its the first time you hit the page.

How can I prevent this with out using Javascript. IE is fine and
likewise for Opera.

Is IE doing the correct thing or is this a bug and Firefox is actually
doing the right thing by remembering?

Thanks
 
H

Harlan Messinger

Hi

Using the following code

<form id="form1" name="form1" method="post" action="">
<input name="radiobutton" type="radio" value="radiobutton"
id="radiobutton" />
<label for="radiobutton">Radio Button One</label>

<input name="radiobutton" type="radio" value="radiobutton"
id="radio" />
<label for="radio">Radio Button Two</label>

</form>

if I preview the page in Firefox, make a selection then hit refresh,
Firefox remembers my choice. I want it start over as if the form is
empty and its the first time you hit the page.

How can I prevent this with out using Javascript. IE is fine and
likewise for Opera.

Is IE doing the correct thing or is this a bug and Firefox is actually
doing the right thing by remembering?

I believe the behavior is undefined, which means browsers can handle it
any way their designers find appropriate. But why should you
second-guess your users' expectations over what will happen? Assuming
they even thought about it, some would probably expect one behavior on
refresh and the others would expect the other. The real question is why
a user would be refreshing the page at all after having started filling
out the form, or why he would have an expectation either way if he did
refresh it.

If your goal is to provide users with a way to clear their entries and
start over, relying on them to guess that refreshing the page might work
isn't the way to go about it anyway. That's what the Reset button is for:

<input type="reset" name="reset" value="Reset">
 
H

harvey

Unfortunately in this scenario, the client is rendering the screen
independant of what the server is telling it to display,

e.g. I have an aspx page telling Firefox that a radio button is
selected and Firefox changes the item, leaving any text on the page out
of synch with the selection.

I hope this makes sense.

Thanks.
 
H

Harlan Messinger

[top-posting corrected]
harvey said:
> Unfortunately in this scenario, the client is rendering the screen
> independant of what the server is telling it to display,
>
> e.g. I have an aspx page telling Firefox that a radio button is
> selected and Firefox changes the item, leaving any text on the page out
> of synch with the selection.

That wasn't apparent from your example, which had no preselected radio
button.

True, if you specify the button to be checked, Firefox ought to display
it as specified in the code.

Javascript in the onload handler does work. If you have text on the page
that synchs with the user's current choice, doesn't that imply that
you're using Javascript?

Still: why do you think users will be refreshing the page while in the
middle of filling out a form?
 
J

Jukka K. Korpela

Harlan Messinger said:
If your goal is to provide users with a way to clear their entries and
start over, relying on them to guess that refreshing the page might
work isn't the way to go about it anyway.

That's correct!
That's what the Reset button is for:
<input type="reset" name="reset" value="Reset">

No! The "reset" button - which should be called destruction button - is for
causing serious frustration when the user hits it by accident. It has other
destructive features too.

Well, maybe it _was_ for the purpose you describe, but it was spoiled by
making it an almost "standard" button that "has" to reside alongside with
the submit button, just to give users a sporting chance of wiping out all of
their input irrecoverably.

The constructive method is that the form handler, after checking and
processing the form data and doing something with it, echoes back a result
page. That page should tell whatever the user needs to know about the
processing. Moreover, if deemed useful, it may then contain a fresh form for
entering a new set of data.
 
G

goliathuy

Maybe you can use a confirm like:
<input type="reset" name="reset" value="Reset"
onClick="if(!confirm('REALY CLEAR THE FORM???'))return
false;"
 
J

Jukka K. Korpela

goliathuy said:
Maybe you can use a confirm like:
<input type="reset" name="reset" value="Reset"
onClick="if(!confirm('REALY CLEAR THE FORM???'))return
false;"

You didn't read comprehensively the message you are responding to, did you?
Comprehensive quoting is so often a symptom of lack of comprehensive
reading.

A scripted "confirm" does not help against the side effects of a reset
button (e.g., hitting Esc in an input field may erase all data in the form)
and does not help at all when scripting is disabled. Besides, people are
used to all kinds of annoying popups and will routinely hit Enter to
confirm. That's misguided, but so is the inclusion of a destruction button.
 
S

Sym

I have had this problem - i basicaly have mini form which is just part
of a page, depending on the radio pressed a different set of inputs are
displayed (hiding/showing divs). The first radio is the default, as is
the div that goes with it.

The problem is if the user presses a radio and then follows a link
elsewhere on the page, when they navigate back, the default div is
displayed, but the radio remains as it was previously selected, so you
need to click on the radio again to get the correct div displaying.

The way round this i suppose would be a script on the body onload event
doing something like this.form.radioname[0].checked = true; however at
that moment in time the form does not exist so you can not script the
radio. I presume the way round this would be some loop or timer in this
function ..... any other ideas ?

rgds
Symeon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top