I´m creating a form with SQLFORM that includes 6 fields.
One field is f_customer with requires IS_IN_DB(....)
Now I'd like to add a new field not taken directly from database. Lets
call it f_extra.
f_customer is a drop-down and f_extra would also be a drop-down. Now I
have a list of questions.
1) Is it possible to get the form.accepts to validate that either
f_customer or f_extra is selected. Both can´t be selected and both can´t
be empty? I remember seeing this discussed on the list not long ago, but
could not find it.
2) If 1) is not possible then I guess I have to put dbio=False and do
the validation "manually". How do I show the error message the same way
web2py does?
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.
4) When using the OPTION helper is it possible to have a different value
of the option then what is shown?
Thank you for all ideas.
Kenneth