Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

Posted on by 502

Hello all,

Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

Where I can write the code to do so and what line of code I will write to attain my goal.

Thank You

Siddhant

*This post is locked for comments

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    Then yes, the code above will work. Just don't forget that you need to call the same thing from active() as well, therefore you should extract it to a separate method. Like this:

    void enableFields()
    {
        SST_CustIDDetails_ds.object(fieldNum(SST_CustIDDetails, CustName)).enabled(SST_CustIDDetails.Payed_sst);
    }
  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    Yes the controls are bounded to data source field.

  • Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    The first question is whether the controls (the checkbox and/or the field) are bound to datasource fields or not.

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    Thank you

    CODE for enable and disable field.

    public void modified()

    {

       super();

       if (SST_CustIDDetails.Payed_sst == true )

       {

           SST_CustIDDetails_ds.object(fieldNum(SST_CustIDDetails,CustName)).enabled(True);

       }

       else

       {

           SST_CustIDDetails_ds.object(fieldNum(SST_CustIDDetails,CustName)).enabled(false);

       }

    }

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    Hello Crispin,

    Can you please tell me exactly where in the SalesTable form.

  • Verified answer
    Crispin John Augustine Profile Picture
    Crispin John Augustine 37,081 on at
    RE: Want to add a check box on a form and when the check box is checked , One field will enable on the form below the check box.

    are you familiar with the Datasource >> field >> modified() method? You have to write a line of code here. NewField.enabled(Datasource.Field == "your condition");

    Search for examples in another standard form. (Eg: SalesTable)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans