I have an insert SQLFORM of 8 fields, to which I'd like to add a single "I agree to terms" checkbox at the bottom. There are probably tons of ways to do this, but I'm hoping someone has a really simple method that doesn't require resorting to a manual FORM? Can I simply tack on another INPUT to the SQLFORM? (Bonus points for placing it after my last field but before the submit button). Here's the current code.
form = SQLFORM(db.job_post, submit_button='Post Job', formstyle='table2cols', fields=['poster_name', 'poster_email', 'poster_phone', 'zipcode', 'location_description', 'job_type', 'job_title', 'job_description'], _id='postjob' ) if form.accepts(request.vars, session): redirect(URL('post_email', vars={'id': form.vars.id, 'poster_name': form.vars.poster_name, 'poster_email': form.vars.poster_email})) What's solution allows me to make the minimal change? The simplest solution that occurs to me is to use a SQLFORM.factory: form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email, db.job_post.poster_phone, db.job_post.zipcode, db.job_post.location_description, db.job_post.job_type, db.job_post.job_title, db.job_post.job_description, FIELD('terms', 'boolean', IS_EQUAL_TO(True)) submit_button='Post Job', formstyle='table2cols', _id='postjob' ) if form.accepts(request.vars, session): form.vars.id = db.job_post.insert(**db.job_post._filter_fields(request.vars)) redirect(URL('post_email', vars={'id': form.vars.id, 'poster_name': form.vars.poster_name, 'poster_email': form.vars.poster_email})) I guess this isn't too onerous, but I don't really like having to manually do the insert, so I'm wondering about alternatives. BTW, why does _filter_fields begin with _ if it's used publicly? Shouldn't it just be filter_fields?