[Vtigercrm-developers] How to detect field value change on Edit View Save?

Alan Lord alanslists at gmail.com
Thu Apr 5 15:15:50 GMT 2018


Thanks - I managed to work it out by looking at the nodelist of the 
element - this doesn't change before the save, e.g.:

> var initialVal = el.attributes.getNamedItem('value').nodeValue;
> var submitValue = jQuery(el).val();

But I have a bigger issue now.

I am triggering my custom validation on the 
Vtiger_Edit_Js.recordPresaveEvent trigger and using e.preventDefault() 
to stop the process.

But, if my custom validation passes and I try to either trigger this 
event again, or just submit the form, I get into a never ending loop of 
Presave, submit(), Presave, submit()...... :-(

Any ideas how to stop/work around this?

TIA

Al


On 04/04/18 17:10, nilay khatri wrote:
> For the same scenario, for the required field on page load we store the 
> values in a static cache/array/object. And then on presaveevent compare 
> the form values with that in cache.
> 
> On Wed, Apr 4, 2018 at 6:14 PM, Alan Lord 
> <alanslists at gmail.com 
> <mailto:alanslists at gmail.com>> wrote:
> 
>     I have a custom "validation" function. This is an ajax routine.
> 
>     In Detail View (and Summary) I can stop the default event
>     "PreAjaxSaveEvent", perform my checks and do what is necessary.
> 
>     In Edit View though I am struggling to determine if a field has had
>     its value altered before the user clicks the save button. I can trap
>     the event "Vtiger_Edit_Js.recordPresaveEvent" OK but is there any
>     way I can determine if a field's value has changed or not?
> 
>     TIA
> 
>     Al
> 
>     _______________________________________________
>     http://www.vtiger.com/
> 
> 
> 
> 
> _______________________________________________
> http://www.vtiger.com/
> 




More information about the vtigercrm-developers mailing list