Okay, for posterity's sake, here is how I got it working:
in model:
db.define_table('games',
Field('parts', widget = SQLFORM.widgets.radio.widget, requires =
IS_IN_SET({'Halves','Quarters'})),
etc
in controller:
form = SQLFORM(db.games)
(in other words nothing special)
in view:
{{=form.custom.begin}}
<input type="hidden" name="_form" value="new_game" />
<div class="btn-group batradio" data-toggle="buttons-radio">
<label class="btn btn-primary" for="partsOne">
<input id="partsOne" name="parts" type="radio" value="Halves" />Halves
</label>
<label class="btn btn-primary" for="partsTwo">
<input id="partsTwo" name="parts" type="radio" value="Quarters"
/>Quarters
</label>
</div>
etc
in app-specific css file:
input[type="radio"] {display:none;}
Note that I did not need to use javascript to get the toggle of the buttons
to work as was described in the Bootstrap 2.3.2 documents. If by the time
you are reading this web2py has migrated to Bootstrap 3 things may be
different, hopefully easier;)
You can see it running here: http://www.sportssquaresonline.com/newGame
This really looks good and I plan to use more in the future - hope this
saves someone else a little grief!
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.