...

View Full Version : Find and validate field names



florida
12-11-2006, 05:13 PM
I am trying to validate all field names in a form that have _theWord in the fieldname.


ac_dajhta_theWord
sd_dfdfe_fdfdv
ca_hereeds_theWord
se_dcvdfdef_dsfd
cx_hserj_theWord


In the above I would need to fetch and validate:

ac_dajhta_theWord
ca_hereeds_theWord
cx_hserj_theWord


Please advise because my attempt is not working.


fuction val()
{
var regexp = /_theWord/;

if(document.myform.name eq regexp)
{
if(document.myform.name == "")
{
alert("Field value is required")
}
}
}

<form name=myform action=goto.cfm onsubmit=return val();>
.....</form>

florida
12-12-2006, 12:21 AM
Thanks, it works great.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum