Thank you. Please check the fix in trunk.

On Sep 7, 3:24 pm, "mr.freeze" <[email protected]> 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 <[email protected]> wrote:
>
> > This may be a bug. If you can track it down let me know.
>
> > On Sep 7, 12:06 pm, "mr.freeze" <[email protected]> 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 <[email protected]> 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" <[email protected]> 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" <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to