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

MAGGI Conrado RE-INGENIA conrado at reingenia.com.ar
Tue Oct 16 07:56:39 PDT 2012


I Agree with Joe.

We use a Ajax to validate the data and if its OK them submit the form.

You can find an example of that in Accounts duplicate check.

Best Regards,

Conrado

On 10/16/2012 11:46 AM, Joe Bordes wrote:
> 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.
>>
> _______________________________________________
> http://www.vtiger.com/



More information about the vtigercrm-developers mailing list