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