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

Joe Bordes joe at tsolucio.com
Tue Oct 16 07:56:22 PDT 2012


On 16/10/12 16:45, Alan Bell wrote:
> On 16/10/12 15:42, Adam Heinz wrote:
>> On Tue, Oct 16, 2012 at 10:34 AM, Alan Bell <alan.bell at libertus.co.uk> wrote:
>>> Any suggestions on how to do a graceful abort of a save during the event
>>> handler?
>> Well, first realize that you have two types of aborted save action to
>> recover from:  DetailViewAjax single field save and Save full entity
>> save.  For the former, it looks like you'll need to output some sort
>> of :#:ERR special error format.  For the latter, it seems easy enough
>> to steal the header redirect from the base of the corresponding
>> Save.php file, but that doesn't provide any error messaging.
>> _______________________________________________
>> http://www.vtiger.com/
> it is the latter, but no, I can't steal that header redirect because I
> don't have a return ID
>
> Alan.
>

I think it is easier to do the validation on the client side, that is 
the way vtiger CRM is designed, but if you do go down this path, you 
could modify the Save.php to validate the error before the save() call, 
and if it is incorrect, redirect to EditView passing in the full 
contents of the $_REQUEST array you received in the Save.php along with 
an error message.
Note that this will not work with webservice interface.

Joe
TSolucio


More information about the vtigercrm-developers mailing list