<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XYZ Travels Pvt Ltd.</title>
<script type="text/javascript" language="javascript">
function a(){
var x = document.forms.frm1.UserID.value;
var y = document.forms.frm1.Pass.value;
if(x=="" || y=="")
{
alert("Required Field cannot be left Blank");
if(x!="")
{
document.forms.frm1.Pass.focus();
}
else{document.forms.frm1.UserID.focus();}
}
else
{
document.forms.frm1.action("Reg.jsp");
}
}
</script>
</head>
<link href="projstyle.css" rel="stylesheet" type="text/css" />
<body><font color="white">
<form method="post" name="frm1">
Login : <input name="UserID" type="text"/>
<br>
Password : <input name="Pass" type="password" maxlength="18"/>
<br>
<input name="btn1" type="button" onclick="a();"/>
<a href="Reg.jsp">Register Now!</a>
</form></font></body>
</html>
how do i cause the form to post to another page? Am I doing it correct? I want this to happen ONLY if validation passes.