hi, 

i want to check onvalidation in sqlform.smartgrid, if the user delete the 
record it will update the other tables value. 
at first i think of using ondelete, but it seems, ondelete on sqlform is 
same like _after_delete callback in dal. so i decide to use onvalidation 
that check the request.args in dispatcher.
i've already inspect elements for the smartgrid and it return :
for delete link (i remove the signature)
/test/purchase/report_purchase_order_draft/purchase_order_header/delete/purchase_order_header/1

for edit link (i remove the signature)
/test/purchase/report_purchase_order_draft/purchase_order_header/edit/purchase_order_header/1

my code :
def __onvalidation_purchase_order(form):
if request.args(-3) == 'edit' and request.args(-2) == 
'purchase_order_header':
if form.vars.is_authorized == 'on':
form.vars.status = 'Purchase Order Authorized'
row_header = 
db(db.purchase_order_header.id==request.vars.id).select().first()
db(db.purchase_requisition_header.id==row_header.purchase_requisition_no).update(status='Purchase
 
Requisition Purchase Order Authorized')
if request.args(-3) == 'delete' and request.args(-2) == 
'purchase_order_header':
row_header = 
db(db.purchase_order_header.id==request.args(-1)).select().first()
# test # row_header = 
db(db.purchase_order_header.id==request.args(0)).select().first()
db(db.purchase_requisition_header.id==1).update(status='Purchase 
Requisition Authorized')
else:
None

my question is, why the same conditional check is work for edit but not for 
delete?

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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to