Forum: Ruby on Rails radio_button_tag - not checking as expected

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
05748a61a1b05130ec508434301aecf1?d=identicon&s=25 Lee (Guest)
on 2007-01-20 00:02
(Received via mailing list)
I have the following radio button in my code:

  <%= radio_button_tag("single_or_collection", "single", checked =
true, options = {:id => "isSingle"}) %>Single
  <%= radio_button_tag("single_or_collection", "collection", checked =
false, options = {:id => "isCollection"}) %>Collection

The "single" button is checked correctly on initial page load.

If however I check "collection" using the mouse and then reload the
page, "collection" is still checked.

I'd like "single" to be checked whenever this page is loaded. Am I
doing something wrong?

70ca58d0e0e0eabbdb74d177417d09d7?d=identicon&s=25 (Guest)
on 2007-01-20 14:39
(Received via mailing list)
This is the way browsers work. When you refresh the page, you most
likely don't want all the stuff you input to the form to be destroyed,
so the browser keeps it. If you do a shift-refresh (empties cache and
loads the page again), the form will be back at it's empty default
This topic is locked and can not be replied to.