Hello,
The CRM environment of my organization send a XML file to the Department of State almost everyday with several of records, the DOS has a few requirements for fields and there are characters that are not allowed. Initially I was using this code to validate these fields
function ValidateSpecialChar()
{
var Regexp=/[^a-zA-Z0-9 ]/; //this will allow space
var value=Xrm.Page.getAttribute("name").getValue();
if (Regexp.test(value)) {
alert("Special Character is Not Allowed !!");
Xrm.Page.getAttribute("name").setValue(null);
}
else {
return false;
}
}
However there are fields that do allow some characters:
- The contacts first and last name must be alphabets ([A-Z][a-z])
- The account names can have 8 special characters such as & , ', ", #, -, /, <, >
- The city name must be alphabets ([A-Z][a-z])
- The phone number attribute can have only 0-9, -, (,) characters as a valid characters
- The postal code attribute can have only 0-9, - characters as a valid characters
Would anyone be able to help me achieve this with Javascript? I can compensate you for time and effort.
*This post is locked for comments