[Vtigercrm-developers] aborting a save in an event handler
Alan Bell
alan.bell at libertus.co.uk
Tue Oct 16 07:34:15 PDT 2012
Hi all,
I have a situation where we want to do a
vtiger.entity.beforesave.modifiable event handler for a SalesOrder This
will do some validation based on a bunch of queries to the database
based on fields in the $entitydata that gets submitted. If the
validation fails and the user isn't allowed to save this order it should
fail, and take them back to the form so they can fix whatever the
problem was and try again.
The problem is that the sales order does not have a crmid yet, it has
not been saved. I can't do the tests on the client side before the form
is submitted and I can't do a history.back() because the browser won't
let me go back through the submit, I get a Document Expired error message.
I can do a die("error message"); which will abort the save and returns
the error message as text to the browser, but this is a bit ugly, and
doesn't help the user get back to the form they came from.
Any suggestions on how to do a graceful abort of a save during the event
handler?
Alan.
--
Libertus Solutions http://libertus.co.uk
More information about the vtigercrm-developers
mailing list