I’m talking about the Twitter Boostrap radio buttons from here: http://twitter.github.com/bootstrap/javascript.html#buttons
I have used them in my view file like this:
<div class="btn-group" data-toggle="buttons-radio">
<input type="button" name="type" class="btn" value="Car">
<input type="button" name="type" class="btn" value="Bicycle">
</div>
But when I submit the form and trying to validate those, I can’t get their values…
echo $_POST['type']; is empty… so how should I access & validate the above “radio” buttons?
The plugin only work for appearances : it does not set anything (except the class). You have to use your own JS to set some real radio buttons, or a unique hidden input.
Demo (jsfiddle)
It seems that
type="button"are not submitted anyway (on my Firefox).This is one approach, an other would be to check on submit which one has the
.activeclass.