function SwitchOnCheck(ElementId)
{
var element = document.getElementById(ElementId);
if (element != null)
element.attachEvent("onkeyup", function()
{
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
var strPass = element.value;
if (strPass == null)
return;
var strLength = strPass.length;
var lchar = element.value.charAt(strLength - 1);
while(lchar.search(mikExp) != -1)
{
strPass = strPass.substring(0, strLength - 1);
if (strPass.length == 0)
break;
strLength = strPass.length;
lchar = strPass.charAt(strLength - 1);
}
element.value = strPass;
});
}
SwitchOnCheck('firstname');
SwitchOnCheck('lastname');
Friday, September 25, 2009
How to restict users from entering special characters in Microsoft Dynamics CRM 4.0
Solution is very simple - just add following script to OnLoad event handler of form:
Labels:
Java Script,
Microsoft CRM 4.0
Subscribe to:
Post Comments (Atom)
Hi a33ik,
ReplyDeletethanks for the script but it has problem that it just updates the last character only..
So if you type @@@@@@@@@@@@@@ ....it will just removed the last @ and text box will still have @@@@@@@@@@@@@...which is problem becuase can save this now..
Regards,
MayankP
Thanks for feedback, Mayank.
ReplyDeleteI've fixed this issue.