After form processing, the value of a boolean is either True or False, not "on" or None. If you want a message that works in onvalidation as well as after processing, you can do:
if form.vars.is_booking: Anthony On Monday, November 30, 2015 at 8:33:31 PM UTC-5, 黄祥 wrote: > > the error traceback is say about the field customer is empty, so i > encountered it with IS_EMPTY_OR(IS_IN_DB() ) form validation. but it's not > the main problem, > the main problem is when using form.validate() it seems that boolean field > type always return false answer even i already tick mark the form field > (boolean field type : is_booking), in example above it always execute the > else part (customer = form.vars.customer) either i tick mark the form field > or not. > what i expected is when user tick mark the form field (is_booking = 'on') > it will do the query and insert the query value into the table (customer = > booking.customer), when user not click the boolean form field (is_booking = > 'off'), it will take the data in form (customer = form.vars.customer) > > thanks and best regards, > stifan > > On Monday, November 30, 2015 at 11:11:02 AM UTC+7, Anthony wrote: >> >> What is the traceback? > > -- 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.