Hi Anthony,
do you have an answer for the second problem? I want to get the number of
items in the list "auswahl":

form = SQLFORM.factory(
        Field("auswahl", "list:string"),
        )



   - If there is only one item in "auswahl" then the type of
   form.vars.auswahl is string and len(form.vars.auswahl) is the length of the
   string.
   - If there is more than one item, the type is list and
   len(form.vars.auswahl) is the desired length.


I think it would be better if "list:string" delivers always a list.
Something like

len(form.vars.auswahl) if isinstance(form.vars.auswahl, list) else 1

is not very pythonic.


2018-05-18 17:03 GMT+02:00 Anthony <[email protected]>:

> On Wednesday, May 16, 2018 at 1:35:02 PM UTC-4, mweissen wrote:
>>
>> I understand that there is no DEFAULT VALIDATOR for 'list:string', but it
>> seems that is not possible to use IS_LENGTH at all.
>>
>
> See the end of this section: http://web2py.com/
> books/default/chapter/29/07/forms-and-validators#Validators. In
> particular, it notes that you can use IS_LIST_OF in conjunction with any
> other validator.
>
> Anthony
>
> --
> 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.
>

-- 
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