15

This looks like a really basic question and I've created dozens of forms, but I just can't see what the problem is here.

I have these two radio buttons:

<input type='radio' class='free atype' value='0' name='dutch' checked='checked'/> Free<br/>
<input type='radio' class='paid atype' value='1' name='dutch' /> Paid

Obviously the first one should be checked by default.

However, when I check the second one and then refresh the page, the second radio remains checked. I know this is wrong behavior, but I can't for the life of me see what I'm doing wrong.

I'm trying this on Firefox.

sveti petar
  • 3,637
  • 13
  • 67
  • 144
  • 1
    just a heads up, autocomplete is not a standard attribute: http://stackoverflow.com/questions/582244/is-there-a-w3c-valid-way-to-disable-autocomplete-in-a-html-form ... this is just an IE/Firefox thing – PlantTheIdea Feb 21 '13 at 18:28

2 Answers2

27

This is what's called auto complete, you can try to turn it off by adding the autocomplete="off" property to your inputs

<input type='radio' class='free atype' value='0' name='dutch' checked='checked' autocomplete="off"/> Free<br/>
<input type='radio' class='paid atype' value='1' name='dutch' autocomplete="off"/> Paid

You can also put it on the <form> the elements are in.

Musa
  • 96,336
  • 17
  • 118
  • 137
  • I see. But, since autocomplete seems to be un-standard, I guess I'm better off checking the default button onLoad using Javascript? – sveti petar Feb 21 '13 at 18:30
  • @robert http://stackoverflow.com/questions/3868299/is-autocomplete-off-compatible-with-all-modern-browsers and http://www.w3.org/TR/html-markup/form.html – Musa Feb 21 '13 at 18:33
1

Use Autocomplete="Off" as one of the properties in a tag

that will make some sense for that code.

satheesh kumar
  • 139
  • 1
  • 2
  • 8