Search the Community
Showing results for tags 'validating the form and'.
-
ok, so now im trying to add a check once the field of the form is filled out correctly, but im having problems outputing the "checked" function check(){ var fnlname, addy, numy, email, city, state, country, zip, namecheck; fnlname = document.getElementById('fnlname'); addy = document.getElementById('addy'); numy = document.getElementById('numy'); email = document.getElementById('email'); city = document.getElementById('city'); state = document.getElementById('state'); country = document.getElementById('country'); zip = document.getElementById('zip'); /*** check to see if 2 sets of words is placed ****/ namecheck = /^[A-Z,a-z][A-Z,a-z]+$/; if(fnlname.value == ''){ fulname.innerHTML = '<b>full name is missing</b>'; return false; }else{ if(!namecheck.test(fnlname)){ fulname.innerHTML = '<b>Both Names Required</b>'; return false; } } /*** if both names are filled in, display a "checked mark" ***/ if(fnlname == namecheck.test(fnlname)){ fulname.innerHTML = '<b>checked</b>'; return false; } if(addy.value == ''){ address.innerHTML = '<b>Address is missing</b>'; return false; }else{ namecheck = /^[A-Z,a-z]+$/; if(!namecheck.test(addy)){ document.getElementById('address').innerHTML = '</b>A full Address is Require</b>'; return false; } } return true; } any tips or hint or help will do just fine