Hello guys,
I am trying to validate the zipcode in US and Canada format. I am trying to use the RegEx . I am getting an error that the previous function in the library is not defined at eval(eval at runHandlerInternal).
I am sure the error is becauce of my zipCode validation . But I can't figure out what is the issue:
Here is my code:
function checkZipcode()
{
var zipCode = Xrm.Page.getAttribute("address1_postalcode").getValue();
if(zipCode ! = null)
{
var isValidZip = (^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$);
if(!isValidZip.test(zipCode))
{
alert("zip invalid");
Xrm.Page.getAttribute("address1_postalcode").setValue(null);
}
}
}
*This post is locked for comments