Form Onsubmit Doesn't Call Javascript Function
I have checked recent blogs about onsubmit event not triggering the method. Those suggestions were not helpful for this problem.And i've tried this method and form in an another ht
Solution 1:
you almost done. simple quotes
problem.you could change like this in your dom
else statement
document.getElementById("firstNameLoc").innerHTML = '<img src="Resource/checked.png"/>Please Enter your First Name';
functionformValidation() {
var fName = document.Log.firstName.value;
var lName = document.Log.lastName.value;
var pName = document.Log.penName.value;
var email = document.Log.email.value;
var password = document.Log.password.value;
var confirmPassword = document.Log.confirmPassword.value;
var status = false;
if (fName.length < 1) {
document.getElementById("firstNameLoc").innerHTML =
"<img src='Resource/unchecked.gif'/>Please Enter your First Name";
status = false;
} else {
document.getElementById("firstNameLoc").innerHTML = '<img src="Resource/checked.png"/>Done..!';
status = true;
}
return status;
}
<divid="_div2"><center><divclass="contianer"><formname="Log"action="SignUpInsert.php"method="post"onsubmit="return formValidation();return false;"><label><b>First Name</b></label><spanid="firstNameLoc"></span><br><inputtype="text"placeholder="Enter your Last Name"name="firstName"><br><label><b>Last Name</b></label><spanid="lastNameLoc"></span><br><inputtype="text"placeholder="Enter your Last Name"name="lastName"><br><label><b>Pen Name</b></label><spanid="penNameLoc"></span><br><inputtype="text"placeholder="Enter your Unique Pen Name"name="penName"><br><label><b>Email</b></label><spanid="emailLoc"></span><br><inputtype="text"placeholder="Enter your Email"name="email"><br><label><b>Password</b></label><spanid="passwordLoc"></span><br><inputtype="password"placeholder="Enter your Password"name="password"><br><label><b>Confirm Password</b></label><spanid="confirmPasswordLoc"></span><br><inputtype="password"placeholder="Enter your Password Again"name="confirmPassword"><br><inputtype="submit"title="Done?"value="Sign Up"><br><divclass="contianer"><buttontype="button"class="cancelBtn"title="Go Back"onclick="location.href='Main.html'">Cancel</button></div></form></div></center>
Post a Comment for "Form Onsubmit Doesn't Call Javascript Function"