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)

How to enable and disable a textbox on form based on checkbox(Control) click

(0) ShareShare
ReportReport
Posted on by 2,114

Hi techies,

We have developed a completely new form, we need to enable and disable one text box on form based on the selection of checkbox present on same form. How can we do this?

We have developed this in visual studio (D365).

Any response is appreciated!

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rohin Profile Picture
    4,624 on at

    I am not sure about D365 fF&O but in AX2012, I can achieve this by writing logic in active() method of datasource . Try to put your logic in active() method of form datasource or wait if someone expert in D365fF&O suggest you solution.  

    Try like this:

     if(tableName.Checkbox == NoYes::Yes)

    {

      tablename_ds.object(fieldNum(tablename,textbox)).enabled(True); // whatever enable or disable you want.

    }

    else

    {

    tablename_ds.object(fieldNum(tablename,textbox)).enabled(false);

    }

    All the Best!!

  • Sangram Shinde Profile Picture
    2,114 on at

    Hi Visvash,

    Thanks for your valuable reply. We did same actually as you answered by adding the checkbox in table instead of form control.

    This is working as expected and your code is absolutely correct as well!

    But what if we need to add a code for a form control(i.e.checkbox) instead of the table checkbox field.

    Thanks again!

  • Suggested answer
    Rohin Profile Picture
    4,624 on at

    that can be doable as well. Declare the AutoDeclartion property of FormControl to "Yes" and get it in active method of formdatasource and put the logic there

  • Sangram Shinde Profile Picture
    2,114 on at

    Thanks Visvash for reply. Can you please bit elaborate more about how to access this form control in active method of formdatasource. We tried but unable to access it. Appreciate your help.

    Thanks!

  • Suggested answer
    Rohin Profile Picture
    4,624 on at

    go to FormControl properties (by right click on FormControl > properties) and select AutoDeclaration to "Yes". It will allow you to access this formcontrol on formdatasource methods and form methods as well.

  • Sangram Shinde Profile Picture
    2,114 on at

    Thanks Sukrut,

    Your suggestion is working for us, perfect!

  • Zohan Profile Picture
    2 on at

    I want to hide/visible some specific field in grid when ever the checkbox value is selected. How would I do that?

    should I write a modified method on checkbox control or gird?

    if(checkbox.value(noyes::yes)

    {

    gridField.visible(true)

    }

    else

    gridField.visible(true)?

    Kindly suggest

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