Question
Java to Cold fusion (form email validation)
Hello to All!
For whom, who knows BOTH Regular expressions in JS and CF
I have:
<script type="text/javascript">
function isEmailCorrect(formname, fieldname) {
var re = /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i;
if(re.test(eval("document.forms['"+formname+"']."+fieldname+".value")))
return true;
else {
alert("Email is incorrect!");
eval("document.forms['"+formname+"']."+fieldname+".focus()");
return false;
}
}
</script>
I'm trying to do server validation and I'm going to use something like
<cfscript>
if (NOT REFindnocase(" EXPRESSION FROM JS ", email)) {
WriteOutput("error");
<cfscript>
But I don't no how to convert
" /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i "
to the CF Regular expressions.
If somebody interested, you can see the "JS" action and idea on
http://www.web-utils.net/files/ex-check-email.html
Thanks to ALL!!!
For whom, who knows BOTH Regular expressions in JS and CF
I have:
<script type="text/javascript">
function isEmailCorrect(formname, fieldname) {
var re = /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i;
if(re.test(eval("document.forms['"+formname+"']."+fieldname+".value")))
return true;
else {
alert("Email is incorrect!");
eval("document.forms['"+formname+"']."+fieldname+".focus()");
return false;
}
}
</script>
I'm trying to do server validation and I'm going to use something like
<cfscript>
if (NOT REFindnocase(" EXPRESSION FROM JS ", email)) {
WriteOutput("error");
<cfscript>
But I don't no how to convert
" /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i "
to the CF Regular expressions.
If somebody interested, you can see the "JS" action and idea on
http://www.web-utils.net/files/ex-check-email.html
Thanks to ALL!!!
