On Thursday, October 30, 2014 3:34:02 PM UTC-4, José Eloy wrote: > > Anthony > > With options I mean SQLFORM.widgets.options.widget. I checked and > discovered that using either SQLFORM.widgets.options.widget or > SQLFORM.widgets.multiple.widget I get an html select element. My question > is how to create a SELECT (no dropdown) with multiple=False. I want to > select only an element of the list. >
It sounds like you want the select box that the browser displays for a multi-select item, but you only want the user to be able to select a single item. Is that correct? If so, why? Is your goal to allow the selection to be optional (i.e., the user can select 0 or 1 options)? If so, that can be achieved with a dropdown via: IS_EMPTY_OR(IS_IN_SET(...)) If you really want a multi-select box that allows only one option, you can also do: IS_IN_SET(..., multiple=(0, 1)) The "multiple" argument can be a tuple/list specifying the minimum and maximum number of allowed options. In this case, you should probably add a comment to the interface warning users, as nothing will prevent them from selecting multiple options in the interface and submitting the form (if more than one is selected, they will get an error message *after* submitting the form). Alternatively, you could use Javascript to prevent multiple selections in the UI. 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.

