I modified your patch.
In trunk try this
Field(...,requires=IS_IN_SET(('a','b','c'),zero=T('choose one')))
the option "zero" will be added at top but not accepted unless:
Field(...,requires=IS_NULL_OR(IS_IN_SET(('a','b','c'),zero=T('choose
one'))))
please give it a try.
Massimo
On Sep 5, 12:03 pm, Iceberg <[email protected]> wrote:
> On Sep5, 11:51pm, "mr.freeze" <[email protected]> wrote:
>
> > Perhaps a better solution is checking if the value for 'default'
> > argument is *not* in the set and then appending it to the set but not
> > allowing it to pass validation if selected. What do you think?
>
> You are a genius! This solution reaches the original goal without any
> known side effect.
>
> And the implementation is simple, too. Just add the following 2 lines
> into OptionsWidget() 's widget(), one line before the final return.
> Problem solved!
>
> if value not in [k for k,v in options]:
> opts += [OPTION(value,_value=value)]
>
> Strongly recommended! Thanks Freeze!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---