On Thursday, March 22, 2018 at 6:54:16 PM UTC-7, Lee Carmichael wrote:
>
> Hey all, I'm trying to implement two check boxes where the first is 
> checked by default, but both or only the second are acceptable checked 
> patterns (at least one must be checked).
>
> In my controller I have the following:
>
> MY_OPTIONS = ['In-service view','Future view' ] 
>
> form = SQLFORM.factory(Field('search',requires=IS_NOT_EMPTY()),
>                                           Field('view', "list:string", 
>                                                     default=MY_OPTIONS[0],
>                                                     
> widget=SQLFORM.widgets.checkboxes.widget, 
>                                                     
> requires=[IS_IN_SET(MY_OPTIONS,  multiple=True),IS_NOT_EMPTY()])).process() 
>
> If I do a print request.vars.search I see the value entered in my search 
> field, as expected. However, when I do a print request.vars.view, I get a 
> "None". I'm totally lost with the widgets. Any insight would be greatly 
> appreciated.
>
> LSC
>

If I recall a discussion from a couple years ago, an un-checked checkbox 
will not be in the vars.

You might want to try searching the list for 'checkbox' ; I think topics 
from March and January of last year may be relevant.

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to