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 AX (Archived)

Overriding click event of a checkbox

(0) ShareShare
ReportReport
Posted on by

Hello all, I have this scenario, in a from I have a checkbox.When the user clicks on that checkbox  I go through some methods and bussiness logic and based on that,I should allow or deny user from altering that checkbox.How can I achieve that?

tried the following with no luck:No mater what i do , I can not alter the state of the checkbox.

public void clicked()
{

//clicked event of the checkbox

run somemethod(); //returns true or false based on other conditions

if(somemethod() == true)

{

this.value(true);

}

else

{

this.value(false);

}

}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    DG Profile Picture
    1,226 on at

    Instead of 'clicked' method, put your code in 'validate' method. If the validate return false, the value of the check-box will not change. Additionally you can give warning message like 'you are not allowed' etc. If the method returns true, then the value will be changed.

    Regards,

    Deepak

  • Community Member Profile Picture
    on at

    Cheers,is there a way to set the value of the checkbox based on that method? If the method returns true , I want the value to be true no matter what the user choses.

  • Suggested answer
    DG Profile Picture
    1,226 on at

    Then try using 'checked' method instead of 'clicked' method.

  • Verified answer
    Iulian Cordobin Profile Picture
    8,201 on at

    I think this will work for your requirement:

    public void clicked()

    {

       //super(); // you have to comment the super call so the value is only set by your logic

       if (your_boolean_condition)

       {

           this.value(true);

       }

       else

       {      

           this.value(false);

       }

    }

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans