[web2py] Re: custom widget doesn't validate correctly

2011-04-14 Thread niknok
Thanks!! Here's the generic version def radio_h(field,value): nbsp=XML(' ') items=[TAG[''](SPAN(name,INPUT(_type='radio', _id="%s_%s" % (field._tablename, field.name), _value=key, _name=field.name,

[web2py] Re: custom widget doesn't validate correctly

2011-04-10 Thread Massimo Di Pierro
You pass the validator to the field so that it passes it to the widget. Your widget does not handle it. You can do: def radio_h(field,value): nbsp = XML(' ') items=[TAG[''] (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value,requires=IS_IN_DB(db, db.gender, '%(descriptio

[web2py] Re: custom widget doesn't validate correctly

2011-04-10 Thread niknok
Sorry for being a little thick but how do I do that? There's already a IS_IN_DB requires in the table definition. On Apr 11, 12:51 am, DenesL wrote: > You forgot to set the requires for t.gender > > On Apr 9, 6:35 pm, niknok wrote: > > > > > > > > > I got this custom widget from the list: > > >

[web2py] Re: custom widget doesn't validate correctly

2011-04-10 Thread Massimo Di Pierro
Denes is right... one caveat... the requires must be passed not just to the Field but ALSO to the INPUT inside the widget. On Apr 10, 11:51 am, DenesL wrote: > You forgot to set the requires for t.gender > > On Apr 9, 6:35 pm, niknok wrote: > > > > > > > > > I got this custom widget from the lis

[web2py] Re: custom widget doesn't validate correctly

2011-04-10 Thread DenesL
You forgot to set the requires for t.gender On Apr 9, 6:35 pm, niknok wrote: > I got this custom widget from the list: > > def radio_h(field,value): >     nbsp = XML(' ') >     items=[TAG[''] > (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)),nbsp,nbsp) >         for key