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)

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,664 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
    305,196 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/

  • vinaytak 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....

  • vinaytak 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....

  • vinaytak 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

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
Jagadabi Profile Picture

Jagadabi 6

#2
ZvikaR Profile Picture

ZvikaR 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans