Bootstrap checkbox buttons hidden status after page refresh
Created by: ghost
I have a form with checkbox toggle buttons (using twitter bootstrap and Rails)
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox"> Option 1
</label>
<label class="btn btn-primary">
<input type="checkbox"> Option 2
</label>
</div>
I click and choose Option 1
. Then I refresh the page. When the page is refreshed all the buttons are reset and Option 1
is not selected any more. However if I go ahead and submit the form, Option 1
is sent to the server as if it was selected (checked). Is this a bug? Is this because of something in cookie. If yes, how can I check the cookie and find the ones that should be pressed and the command to change their status to pressed.
I have text fields (<input type='text'>
) in the form also. If I write in the text fields and refresh the page, the texts stay. It seems somewhere behind the scenes the state of the buttons stay as checked, too, but on the display I see them as un-checked. Therefore although the checkbox buttons seem to be un-checked when I submit the form they get submitted as checked.
Thanks a lot.