I am using JavaScript function in my register page to check whether all the fields in register page are filled or not.
I am using Form
<form name="regform" onsubmit="return validateFormOnSubmit(this)" method="post" >
coding here......
</form>
onsubmit i call my javascript function validateFormOnSubmit(this) as shown above.
now if all fields are collect means All fields are filled correct
now i want to post my this page on other page like index.php how it possible.
my java-script alert like that
function validateFormOnSubmit(theForm) {
var reason = "";
reason += validatereferrer(theForm.referrer);
reason += validateEmail(theForm.email);
reason += validatePassword(theForm.pw1, theForm.pw2);
reason += validatebuisinessname(theForm.buisinessname);
if (reason != "") {
alert("Please fix the following error(s) and resubmit:\n\n" + reason);
return false;
}
alert("All fields are filled correctly");
return false;
}
Set the
actionon the form to be the page you want to forward to. Also ensure thatvalidateFormOnSubmit()returnsfalseif the validation fails so that thePOSTrequest is aborted. It should also returntrueif the validation is a success.For example: