I'm wondering about further usage of "a*dding extra form elements to
SQLFORM", as written in the manual (link and code at the bottom). I have a
table that works fine to insert records into, fully automated with SQLFORM.
When I added an agree field to the SQLFORM, the form is still accepted upon
posting, but the form data is no longer saved like it was before. Does it
mean I now have to manage all data saving manually, when adding an extra
form element? If so, what is the best practice to save this form data?**I'm
just using a simple table, something like a table with the name "person",
and columns "name", "age", "profession". The table will upscale, and since
there are so many ways to do things in web2py I don't know where to start!*
*
*
*
*
*
________________________________________________________________________________
*
http://web2py.com/books/default/chapter/29/07#Adding-extra-form-elements-to-SQLFORM
Adding extra form elements to SQLFORM
Sometimes you may wish to add an extra element to your form after it has
been created. For example, you may wish to add a checkbox which confirms
the user agrees with the terms and conditions of your website:
form = SQLFORM(db.yourtable)
my_extra_element = TR(LABEL('I agree to the terms and conditions'),
INPUT(_name='agree',value=True,_type='checkbox'))
form[0].insert(-1,my_extra_element)
The variable my_extra_element should be adapted to the formstyle. In this
example, the default formstyle='table3cols' has been assumed.
After submission, form.vars.agree will contain the status of the checkbox,
which could then be used in an onvalidation function, for instance.
--
---
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.