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: 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,438 User Group Leader 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
    301,075 Super User 2025 Season 2 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

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