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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Forms : Input Values Check (restrict input values)

(0) ShareShare
ReportReport
Posted on by

I have simple form in which user input values

Requirement :     I dont want to allow the user to input the following values in a field

colon, hyphen

I also want to disallow values greater than 12 digits ...

I want error in these cases ..how can I acheive that?

*This post is locked for comments

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

    What about simply putting your logic to validateField()?

  • yasu Profile Picture
    on at

    yes sir you are right ...please see this

    public boolean validate()

    {

       boolean ret;

       ;

      if(AXM_ItemMacAddress.StartMacAddress ==  ' : ')

      {

          info('You cannot insert this value');

          ret = false;

      } else {

       ret = super();

       }

       return ret;

    }

    the problem is here is the error or check only comes into action when the inserted value equals

    :(colon)... but I want the error to be there for values like AA:  or 12:12 etc etc

    I would be great if I can replace the == in the code with "contains "..  :(

    please help

  • Verified answer
    Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    You can use strContains(), like this:

    public boolean validateWrite()
    {
        boolean ret = super();
    
        ret = ret && this.checkStartMacAddress();
    
        return ret;
    }
    
    
    public boolean checkStartMacAddress()
    {
        if (strContains(this.StartMacAddress, ':'))
        {
            return checkFailed("You cannot insert this value");
        }
        return true;    
    }

    By the way, if you have more complex patterns (such as if you want to check whether this input is a valid MAC address), regular expressions are usually a better approach than writing all the logic in your own code.

  • Anand AX Profile Picture
    2,172 on at

    Hi yasu,

    Refer this link

    daxbeginners.wordpress.com/.../how-to-validate-special-characters

    It may help you!

  • yasu Profile Picture
    on at

    thank you very much martin I have done this .. because of your help

  • Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    yasu, when you get an answer, don't forget to mark the thread as answered by marking the helpful reply (replies). Notice "Did this answer your question?" beside each reply.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans