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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JavaScript Web Resource on Check Box field type

(0) ShareShare
ReportReport
Posted on by

I have a Check Box field on a Quick Create Lead form and I want to perform some action when ever this field is selected(Checked) on OnChange Event. I have created a JavaScript Web Resource and it is performing the action whenever the check box field is selected(Checked), but the problem here is that it is performing that action even when the check box field is Unchecked. 

How to prevent that action while user is trying to Uncheck the check box field?   

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: JavaScript Web Resource on Check Box field type

    I applied the same function and it worked for me, thanks Radu

  • Verified answer
    Radu Chiribelea Profile Picture
    6,667 on at
    RE: JavaScript Web Resource on Check Box field type

    Hi Sunny,

    This is expected behavior. The event handler is triggered on the on change event. Both checking and unchecking the box are considered on change events.

    To prevent the logic from being executed when the box is unchecked, you can add some extra logic inside the onchage method and verify the value of the field. If it is null simply return.

    Something llike

    function OnChangehandler(){

    var field = Xrm.Page.getAttribute("<your_checkboxfield">)

    if(field==false){

    return}

    else{

    //your logic here

    }

    }

    Hope this helps,

    Radu

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans