Radio_button_tag - not checking as expected

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?

Thanks.

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
state.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs