Unfortunately dictform does not support this. You can do:
session.config = dict(NAME = 'a')
form =
SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'),
error_message="Choose between a and e")))
if form.process().accepted:
session.config['NAME'] = form.vars['NAME']
On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote:
>
> Hello :)
>
> I have following code in controller:
>
> session.config = dict(NAME = 'a')
> form = SQLFORM.dictform(session.config)
> form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'),
> error_message="Choose between a and e")
> if form.process().accepted:
> session.config.update(form.vars)
>
> validator is working OK, but I would like to change the type of NAME field
> in form to select dropdown, instead simple input. How to do this ? How to
> change the type of field after it is created by any SQLFORM(.*) ?
>
> Regards
> brushek
>
--
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/groups/opt_out.