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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to: Validate special characters?

(0) ShareShare
ReportReport
Posted on by 371

How to: Validate special characters in a filed that are not allow only alpha numeric value it accepts 

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    Hi,

    you can make use of Regex expressions(System.Text.RegularExpressions.Regex). Have a look at an example shown in an old post.

    community.dynamics.com/.../171654

    additionally if you will search about regex expressions, you can find lot of material on it.

  • Suggested answer
    Basheer17 Profile Picture
    2,720 on at

    Define all special characters in a list. Use strContains function by iterating through the list.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    306,446 Super User 2026 Season 1 on at

    Hi Vinay,

    You can solve it with coding. You can call Regular Expressions. How to use this can be found in an example: WinAPI::isFileNameValid OR SysEmailDistributor::validateEmail

    If you need to know more about regular expressions, you can learn on this site: http://regexr.com/

  • CU02060633-1 Profile Picture
    371 on at

    i have a simple field "name" edt  is string 30 ...i have a simple form in that name field sholud not allow any special char.. so i write the validate method in table but its not working they are accepting all the character .. can u give me a example regrading this how to use it....

  • CU02060633-1 Profile Picture
    371 on at

    i have written the code in the table

    public boolean validateField(FieldId _fieldIdToCheck)

    {

       String30        teachername;

       boolean ret;

       ret = super(_fieldIdToCheck);

       if(ret)

       {

           switch (_fieldIdToCheck)

           {

                case fieldNum (Validationtale,teachername):

                if(strContains(teachername,"!@#$%^&*()_+=-[{]};:',<.>/?/-*+"))

           {

               Box::info("Special Character Is not Allowed ");

                  return checkFailed(strFmt("Invaild characters"));

                  }

                    else

                       {

                       break;

                       }

           }

       }

    return ret;

    }

    but in form they are accepting the special charc....

  • CU02060633-1 Profile Picture
    371 on at

    @Crispin John Augustine .... it doesnt throw any error also when i am done written it can easily move to the nxt field

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans