My pleasure.  I think the same thing applies for CheckboxesWidget.

On Sep 7, 6:28 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Thanks Nathan.
>
> On Sep 7, 6:05 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > Tested and working.
>
> > On Sep 7, 4:12 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Thank you. Please check the fix in trunk.
>
> > > On Sep 7, 3:24 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > It looks like the validator is being applied to the TR object for
> > > > RadioWidget and CheckboxesWidget, not the INPUT objects. Since TR
> > > > inherits from DIV, DIV's _validate method is called which always
> > > > returns True.  Passing the INPUT the 'requires' attribute fixes it
> > > > (line 248 sqlhtml.py):
>
> > > > opts += [TR(INPUT(_type='radio', _name=field.name,
> > > >                           _value=k, value=value, requires=attr
> > > > ['requires']), v) for (k, v) in options]
>
> > > > On Sep 7, 1:49 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > This may be a bug. If you can track it down let me know.
>
> > > > > On Sep 7, 12:06 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > I noticed that too.  I am trying to track it down now.  It looks 
> > > > > > like
> > > > > > validation is not getting called at all for IS_IN_SET when using the
> > > > > > RadioWidget.
>
> > > > > > On Sep 7, 12:01 pm, Iceberg <iceb...@21cn.com> wrote:
>
> > > > > > > Well, after some test, I am convinced that the 
> > > > > > > IS_IN_SET(...,zero='')
> > > > > > > and IS_IN_DB(...,zero='') are also a good solution. Thanks both of
> > > > > > > you!
>
> > > > > > > BTW, Freeze's example is illuminative. But somehow, choosing a 
> > > > > > > "zero"
> > > > > > > value doesn't generate an error message, even after I fixed a 
> > > > > > > typo as
> > > > > > > below:
> > > > > > >   form=SQLFORM.factory(Field('choice',requires=IS_IN_SET
> > > > > > >  (('Yes','No'),zero='Maybe'),widget=SQLFORM.widgets.radio.widget))
>
> > > > > > > On Sep8, 0:34am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > > > Here is an example of using IS_IN_SET without a dropdown:
>
> > > > > > > > form=SQLFORM.factory(Field('choice',requires=IS_IN_SET
> > > > > > > > (('Yes','No','Maybe')),widget=SQLFORM.widgets.radio.widget))
>
> > > > > > > > On Sep 7, 11:23 am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > > > > Yeah, it doesn't feel as elegant (adds 8 lines instead of 2) 
> > > > > > > > > but
> > > > > > > > > having it in the validators means it can be used by custom 
> > > > > > > > > widgets.
>
> > > > > > > > > On Sep 7, 11:11 am, Iceberg <iceb...@21cn.com> wrote:
>
> > > > > > > > > > I won't argue that whether just two lines of code would 
> > > > > > > > > > make a "too
> > > > > > > > > > heavy" sqlhtml.py become "unacceptably heavy", but at least 
> > > > > > > > > > the
> > > > > > > > > > IS_IN_DB does not benefit from the improvement if it is not
> > > > > > > > > > implemented inside OptionsWidget.
>
> > > > > > > > > > By the way, would you give an example about "use the 
> > > > > > > > > > IS_IN_SET
> > > > > > > > > > validator without having the dropdown"?
>
> > > > > > > > > > On Sep7, 11:55pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > > > > for various reasons:
> > > > > > > > > > > - sqlhtml is already too heavy, the more we delegate to 
> > > > > > > > > > > the validators
> > > > > > > > > > > and the wdgets the better
> > > > > > > > > > > - because one should be able to do use the IS_IN_SET 
> > > > > > > > > > > validator without
> > > > > > > > > > > having the dropdown
>
> > > > > > > > > > > I added the missing like and uploading...
>
> > > > > > > > > > > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to