for this refer:
http://blog.arkesystems.com/post/2011/06/22/Parsing-and-Validating-Phone-Numbers-in-CRM-2011.aspx
http://rudravarmabata.blogspot.in/2012/05/mobile-number-validation-using-regex.html
http://blog.arkesystems.com/post/2011/06/22/Parsing-and-Validating-Phone-Numbers-in-CRM-2011.aspx
http://rudravarmabata.blogspot.in/2012/05/mobile-number-validation-using-regex.html
function validatePhone(context)
{
{
var phone =context.getEventSource().getValue();
var sTmp = phone.replace(/[^0-9]/g, "");
phoneRegex = /^\d{10}$/;
var sTmp = phone.replace(/[^0-9]/g, "");
phoneRegex = /^\d{10}$/;
if( !sTmp.match( phoneRegex ) )
{
event.returnValue = false;
alert("Phone must contain 10 numbers.") ;
}
else
{
var sTmpClean = "(" + sTmp.substr(0, 3) + ") " + sTmp.substr(3, 3) + "-" + sTmp.substr(6, 4);
context.getEventSource().setValue(sTmpClean);
}
}
{
event.returnValue = false;
alert("Phone must contain 10 numbers.") ;
}
else
{
var sTmpClean = "(" + sTmp.substr(0, 3) + ") " + sTmp.substr(3, 3) + "-" + sTmp.substr(6, 4);
context.getEventSource().setValue(sTmpClean);
}
}
give this javascript and check the field pass the parameters in onchage form.
No comments:
Post a Comment