onchange event triggering at onsave in form RRS feed

  • Question

  • Hi,

    I am doing some validations at the onsave and onchange event in a form. The problem is when I click the save button both the onchange and onsave events get triggered in IE and i get 2 alerts. Is there any way to prevent this from happening?

    Thanks Vineet

    Friday, May 29, 2015 1:28 PM

All replies

  • I hope this will be helpful (for fax attribute and fax control):

    function Fax_Validation(fldCtx) {
        if (fldCtx != null)
            alert("This is Alert From OnChange()");
        else { //This will be from Save
            if (Xrm.Page.ui.getCurrentControl() == null || Xrm.Page.ui.getCurrentControl().getName() != "fax") //Alert was  already call from onChange
               alert("Only one from onSave");

    fldCtx is only available if you call OnChange().

    Sunday, May 31, 2015 5:09 PM