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)

Change the Textbox value dynamically

(0) ShareShare
ReportReport
Posted on by

Hi

I have a textbox (Textbox1)

And 2 date fields (DateFrom and DateTo)

If the datefrom and dateTo is a valid date, the textbox's value must be changed. The value format is: "some name" + " F ".

If the dateFrom and dateTo is a valid date the "F" must be visible and and if its not valid, it shouldn't be visible.

 

Any suggestion where I can put in the code? and maybe how to code this?

 

thanks.  

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    Are your controls bound to a datasource?

  • Community Member Profile Picture
    on at

    yes they are.

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    In that case, don't try to work with form controls directly - work with datasource fields. If you logic is specific to one particular form, trigger it from the datasource node on your form. If it makes sense for the table regardless in which form it's used, implement it on the table itself.

    One approach is setting the text immediately after changing date (before saving the record), another way it doing it on saving.

    Decide which way you want to go and then we can discuss details.

  • Community Member Profile Picture
    on at

    The text must be set immediately. Cause when I set the 2 dates, then the text should be set.

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    Then your trigger will be either modified() methods on datasource fields, or modifiedField() method on the table, depending on which approach you choose.

  • Community Member Profile Picture
    on at

    Thanks Martin

    I will try it.

  • Community Member Profile Picture
    on at

    I put this in modified() for my dateTo field. But it doesnt get triggered when I change the date.

     if(SalesAgreementHeader.NCFIndicatorTo >= today())
        {
            if(!strScan(SalesAgreementHeader.NCCustomerDBName," F ",1,strLen(SalesAgreementHeader.NCCustomerDBName)))
            {
               SalesAgreementHeader.NCCustomerDBName =  SalesAgreementHeader.NCCustomerDBName + " F ";
            }
            
        }


     

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    How did you verify that the method isn't get called? Don't you have modified() on the control itself without calling super()?

  • Community Member Profile Picture
    on at

    i tried to set a breakpoint inside the the method. And it doesn't catch the breakpoint.

  • Community Member Profile Picture
    on at

    I have the modified method with super(). Should I remove the super() call?

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