[Vtigercrm-developers] aborting a save in an event handler

Joe Bordes joe at tsolucio.com
Tue Oct 16 07:46:35 PDT 2012


Why can't you do the validations on the client side?


On 16/10/12 16:34, Alan Bell wrote:
> 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.
>



More information about the vtigercrm-developers mailing list