<div dir="ltr">Right, you need to have a flag for that and set its value based on whether it passed the validation or not.<div><br></div><div>If flag is set then you do not preventdefault.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 5, 2018 at 8:45 PM, Alan Lord <span dir="ltr"><<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks - I managed to work it out by looking at the nodelist of the element - this doesn't change before the save, e.g.:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
var initialVal = el.attributes.getNamedItem('va<wbr>lue').nodeValue;<br>
var submitValue = jQuery(el).val();<br>
</blockquote>
<br>
But I have a bigger issue now.<br>
<br>
I am triggering my custom validation on the Vtiger_Edit_Js.recordPresaveEv<wbr>ent trigger and using e.preventDefault() to stop the process.<br>
<br>
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()...... :-(<br>
<br>
Any ideas how to stop/work around this?<br>
<br>
TIA<br>
<br>
Al<span class=""><br>
<br>
<br>
On 04/04/18 17:10, nilay khatri wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
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.<br>
<br></span><span class="">
On Wed, Apr 4, 2018 at 6:14 PM, Alan Lord <<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a> <mailto:<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>>> wrote:<br>
<br>
    I have a custom "validation" function. This is an ajax routine.<br>
<br>
    In Detail View (and Summary) I can stop the default event<br>
    "PreAjaxSaveEvent", perform my checks and do what is necessary.<br>
<br>
    In Edit View though I am struggling to determine if a field has had<br>
    its value altered before the user clicks the save button. I can trap<br>
    the event "Vtiger_Edit_Js.recordPresaveE<wbr>vent" OK but is there any<br>
    way I can determine if a field's value has changed or not?<br>
<br>
    TIA<br>
<br>
    Al<br>
<br>
    ______________________________<wbr>_________________<br>
    <a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
<br>
<br>
<br>
<br></span>
______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
</blockquote></div><br></div>