checkbox 1,2,3 requires you to have multiple possible values that can be 
checked. In your code only one checkbox is created: it's not strange that 
with your code only one checkbox is rendered.
Check CheckboxesWidget in gluon/sqlhtml.py to understand how web2py 
generates the standard checkboxes widget and start from there.


On Monday, December 3, 2012 3:46:40 AM UTC+1, Julian Sanchez wrote:
>
> I'm trying to have a couple of forms showing a list of checkboxes that 
> follow this structure:
>
> <div class="control-group">
>   <label class="control-label">Checkboxes</label>
>     <div class="controls">
>       <label><div class="checker" id="uniform-undefined"><span><input 
> type="checkbox" name="radios" style="opacity: 0;"></span></div> First 
> One</label>
>       <label><div class="checker" id="uniform-undefined"><span><input 
> type="checkbox" name="radios" style="opacity: 0;"></span></div> Second 
> One</label>
>       <label><div class="checker" id="uniform-undefined"><span><input 
> type="checkbox" name="radios" style="opacity: 0;"></span></div> Third 
> One</label>
>     </div>
> </div>
>
> I'm trying to create a custom widget as per the book but all that shows up 
> is a single checkbox with no label
> Obviously I'm doing something wrong.  The function I'm using is below.  I 
> would appreciate some pointers to get it to work.
>
> def custom_checkbox_widget(field, value):
>     checkbox = INPUT(_name=field.name,
>                      _id="%s_%s" % (field._tablename, field.name),
>                      _class=field.type,
>                      _value=value,
>                      _type="checkbox",
>                      requires=field.requires)
>     span = SPAN(checkbox)
>     div = DIV(span, _class="checker")
>     label= LABEL(div, value)
>     return label
>
>
>
>
>
>

-- 



Reply via email to