Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find and validate field names

    I am trying to validate all field names in a form that have _theWord in the fieldname.
    Code:
    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.
    Code:
    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>

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, it works great.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •