is there any differences when form validation using onvalidation and form.validate for boolean data type? *example 1 work when using onvalidation* # onvalidation_check_in *def __onvalidation_check_in(form):* * if form.vars.is_booking == 'on':* if form.vars.booking_no: rows = db(db.booking.id == form.vars.booking_no).select() for row in rows: form.vars.field = row.field form.vars.customer = row.customer else: form.errors.booking_no = 'enter a value' else: if not form.vars.field: form.errors.field = 'enter a value' elif not form.vars.customer: form.errors.customer = 'enter a value' # check_in def check_in(): table = db.check_in onvalidation = __onvalidation_check_in return futsal_transaction.form_0(table, onvalidation)
*example 2 not work when using form.validate an error traceback occured* # check_in def check_in(): form = SQLFORM(db.check_in) * if form.validate(formname = 'form_header'):* * if form.vars.is_booking == 'on':* booking = db(db.booking_header.id == form.vars.booking_no).select().first() db.check_in.insert(check_in_date = form.vars.check_in_date, is_booking = form.vars.is_booking, booking_no = form.vars.booking_no, customer = booking.customer) else : db.check_in.insert(check_in_date = form.vars.check_in_date, is_booking = form.vars.is_booking, booking_no = form.vars.booking_no, customer = form.vars.customer) return dict(form = form) any idea why example 2 is not work? thanks and best regards, stifan -- 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.