On Saturday, July 23, 2011 1:33:09 PM UTC-4, Kenneth wrote: 
>
> > 3) Instead of creating a custom layout for this form I d like to add the
> > field in the controller with something like:
> > form.element('table').insert(2,TR('label',INPUT(_name='name'))), but how
> > do I add a SELECT with many OPTIONS? The f_extra field drop-down is
> > created from two different tables auth_user and t_extra_fields. I guess
> > I should use query auth_user and t_extra_fields and then create a list.
> > That list is used to create the drop-down.
> Is this a FORM or  SQLFORM. In the latter case you need a custom
> widget. In the former case you can do 
>
> SELECT(*[OPTION(value) for value in ....],**dict(value='default'))
>
Note, since the additional field being added is _not_ associated with the 
database table (if I understand correctly), then I think this method should 
work even for a SQLFORM, as per 
http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-to-SQLFORM
.
 
Anthony
 

Reply via email to