Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

how to set restrictions for the field?

$
0
0

Can anyone help me to find the error.

I need to set the field "areacode" between 0 and 9 while the user to enter only 5 digits 

function areacode (executionObj, CallFrom)
{
var areacode = Xrm.Page.getAttribute("new_countryareacode").getValue();
var regularExpression = /[0-9]{0,5}/;

input type="text" onkeypress="return restrictInput(this, event, digitsOnly);"

if(areacode != null)
{
if(regularExpression.test(areacode) == false)
{
if(CallFrom == 'On Save')
{
alert('Form will not be saved.\nPlease enter a valid area code format such as\nxxxx (5 digits)');
executionObj.getEventArgs().preventDefault();
}
else
{
alert('Please enter a valid area code format such as\nxxxx(5 digits)');
}
}

}

}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images