web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Onchange event gets fired when value is set programmatically using "setvalue "

(0) ShareShare
ReportReport
Posted on by

Hi,

I have an onchange event set on a composite  field  (Address) on the form. Whenever the value changes in the field the onchange event gets fired. However on Save event of the page i am changing the value of the same field programmatically using Xrm.Page.getAttribute("new_abc").setvalue(value)

Due to this, after save operation, the onchange event gets fired automatically. This is causing some issues on the page. i do not want the onchange to get fired after save. 

Note : I have read that onchange events do not fire with setvalue. However i am still not able to make out why is this happening.

I do not want the onchange to fire after on save. Is there way to find out the source through which the onchange event is getting fired so that i can distinguish between when it is getting fired programmatically versus when getting fired from Form. 

*This post is locked for comments

I have the same question (0)
  • AnkitSingh Profile Picture
    115 on at

    Same thing is happening in my case.

    Please let me know if you find any solution.

  • Community Member Profile Picture
    on at

    Do you have an example? Is the function also called as part of the form onLoad? This does get called on save.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Kindly check the on_load event in the form.

  • Suggested answer
    Sartaj Profile Picture
    880 on at

    Hi NancyMartha,

    Are you using MS Dynamics CRM 2015 Update 1?

    If yes, the issue actually you are facing is a bug technically in turbo form used in new form rendering engine introduce in 2015 update 1.

    You can get out of this issue till the time it will fix in future updates by enabling Use Legacy form rendering.

    In order to enable this setting navigate to Settings --> Administration --> System Settings

    With in General Tab select YES for the option Use Legacy form Rendering and Click OK.

    Reload CRM by F5 and check.

    Hope this helps, Please mark this answer as verified if this works for you,thanks.

    Sartaj

  • Suggested answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi NancyMartha,

    You can get the event source,Please use the below code:

     var eventSource = context.getEventSource();        

           if (typeof eventSource.getName != 'undefined') {

           var    sourceName = eventSource.getName();

           }

    Hope this will help you.

    Thanks

    Hemant

  • AnkitSingh Profile Picture
    115 on at

    Sartaj

    Can you please provide a link where this is listed as a bug.

  • Verified answer
    Sartaj Profile Picture
    880 on at

    Hi Ankit,

    We faced this issue in one of our crm online 2015 implementation. Actually what was happening in our case that on change of an option set we are giving a confirmation dialog to user, if user click on Cancel we are setting that option set to NULL programmatically but this caused again onChange event fire and went in loop.

    We raise this concern with Microsoft and got reply that it is a bug which will resolve in future release with a workaround to enable Use Legacy Option from system setting. Thanks.

    Sartaj

  • Suggested answer
    Jitendra Sahu Profile Picture
    2 on at

    You may put below lines to overwrite existing funcationality of your control.

    var cntr=Xrm.Page.getControl("<your control Id>");

    cntr.setAttribute("onchange", function(){});

  • Fede Jousset Profile Picture
    30 on at

    I was struggling with this issue until I tried your solution. Thanks Sartaj!

  • Jonas Rapp Profile Picture
    536 on at

    Do you know if there is a Connect item to vote up for this?

    Or have you seen any schedule for release of this fix?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans