hi,

form validate check form vars seems not working when put the conditional 
logic on it. already tried :
- form.vars
- request.vars
- request.get_vars
- request.post_vars
but it seems that everything is ignore by the form logic.
e.g.
*models/db.py*
db.receipt_header.receipt_type.requires = IS_IN_SET([('Purchase Order', 
T('Purchase Order') ), 
                                                     ('Purchase Return', 
T('Purchase Return') ), 
                                                     ('Sale Return', 
T('Sale Return') ) ] )

*controllers/default.py*
def receipt_form():
    form = SQLFORM(db.receipt_header)
    if form.validate():
        if form.vars.receipt_type == 'Purchase Order':
            db.receipt_header.purchase_order_no.notnull = True
            db.receipt_header.purchase_order_no.required = True
        elif form.vars.receipt_type == 'Purchase Return':
            db.receipt_header.purchase_return_no.notnull = True
            db.receipt_header.purchase_return_no.required = True
        elif form.vars.receipt_type == 'Sale Return':
            db.receipt_header.sale_return_no.notnull = True
            db.receipt_header.sale_return_no.required = True
    return dict(form = form)

any idea how how to achieve it using web2py way?

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.

Reply via email to