[web2py] Adding extra form elements to SQLFORM
I am having trouble properly formatting my extra elements to match the rest of the form. This is a quote from the web2py book below. Can someone tell me what is exactly meant by "*The variable my_extra_element should be adapted to the formstyle*"? I am using bootsrap3_inline as formstyle, and all the parts of my extra element show up in the leftmost column. 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: 1 2 3 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. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Adding extra form elements to SQLFORM
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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] adding extra form elements in a
Hi, chapter 7.2.8 of the books tells how to add extra form elements to SQLFORM. My question: I want to use a SQLFORM.smartgrid. On adding a new record a SQLFORM appears. It is possible to add an extra form element to this form? Concrete: I want to add a button to activate a datepicker in the line above Regards, Martin