On Thursday, March 30, 2017 at 6:17:25 AM UTC-4, Frank Claessen wrote: > > Thx Nico, > > I just figured out that it is indeed a string. However, as soon as I > select more than 1 row, it becomes a list. I was under the assumption that > it is always a list - appears not to be true. > > Perhaps a suggestion to use one single format - list?? >
When you post data from a single checkbox, web2py has no way of knowing that the item could in some circumstances be part of a list and that you therefore want it in a list. You are responsible for writing such code. It would not make sense to put all checkbox values in lists, and even if it did, web2py doesn't know that a given form value came from a checkbox (the browser just sends the field name and value, not its type). Note, in some circumstance, web2py does handle this for you. For example, if you use the IS_IN_SET or IS_IN_DB validators with multiple=True, when only a single item is selected, web2py will still return that item in a list (after running the 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.