We want to restrict users from entering any special characters other than Carriage Return(CR),comma, space. This is done on a Custom VF page. We are trying to achieve this using validation rules/Regex. please help,
you are using in a vf page..right? i thought it in a validation so use the same regex like this in script..and place the script in vf page
<script > function show() { var phn=document.getElementById("{!$Component.pg.fm.pgb.pbs.one}"); var pattern=^[a-zA-Z0-9,.!? ]*$; if(!pattern.test(phn.value)) { alert("some thing you want to see"); phn.focus(); return false; } } </script>
try this regex ^[a-zA-Z0-9,.!? ]*$
hope this helps you..
Thanks
Vishnu R
It didnt work. I tried:
REGEX([a-zA-Z0-9,.!? ]*$)
Error: Syntax error. Missing '='
NOT(REGEX( your field name ,"^[a-zA-Z0-9,.!? ]*$"))
hope this helps you
thanks
Vishnu R
you are using in a vf page..right? i thought it in a validation
so use the same regex like this in script..and place the script in vf page
<script >
function show()
{
var phn=document.getElementById("{!$Component.pg.fm.pgb.pbs.one}");
var pattern=^[a-zA-Z0-9,.!? ]*$;
if(!pattern.test(phn.value))
{
alert("some thing you want to see");
phn.focus();
return false;
}
}
</script>
hope this helps you..
thanks
Vishnu R