Javascript validate empty fields -
can me on how validate javascript form if following fields empty? doesn't seem work code.
function addvalidation(){ var w = document.forms["shop"]["w"].value; var t = document.forms["shop"]["t"].value; var = document.forms["shop"]["a"].value; var c = document.forms["shop"]["c"].value; var s = document.forms["shop"]["s"].value; var c = document.forms["shop"]["c"].value; if (w == "" || t =="" || == ""|| c == "" || s == "" || c == "") { alert("mandatory fields must filled out"); return false; }
please use following code
function addvalidation(){ var w = document.getelementbyid("w").value; var t = document.getelementbyid("t").value; var = document.getelementbyid("a").value; var c = document.getelementbyid("c").value; var s = document.getelementbyid("s").value; var c = document.getelementbyid("c").value; if (w == "" || t =="" || == ""|| c == "" || s == "" || c == "") { alert("mandatory fields must filled out"); return false; }
Comments
Post a Comment