K
KL
I am trying to get a form to work with validating a checkbox. It
validates the checkbox ok, but it always redirects, even if the box
isn't checked...it does alert, but I was hoping that it would stay on
the current page and not redirect unless the box IS checked. I really
can't see what I did wrong. Any and all help would be appreciated.
My code so far is:
<HTML>
<HEAD>
<TITLE>Application</TITLE>
<script type="text/javascript">
function validate()
{
var test=document.getElementById("CCAcknowledgement").checked
submitOK="true"
if (test==false)
{
alert ("To process your information, you must acknowledge that your
credit report will be verified and
analyzed. Please check the appropriate box.")
}
{
window.navigate('index3.html');
}
</script>
</HEAD>
<BODY bgcolor="#3867AD"
onLoad="self.focus();document.Miniapp.FirstName.focus()">
<CENTER>
TEST OF APPLICATION LINK
</CENTER>
<CENTER><TABLE BORDER="0" WIDTH="500"><TD>
<FORM METHOD="POST" ACTION="gdform.asp" name="Miniapp"
ONSUBMIT="validate();">
<input type="hidden" name="subject" value="Application Submission" />
<input type="hidden" name="redirect" value="index3.html" />
<p> </p>
<FIELDSET>
<LEGEND><b>Step Three: Credit Check Acknowledgement</b></LEGEND>
<p><INPUT TYPE="checkbox" id="CCAcknowledgement"
onclick="ToggleCheck()"
name="CCAcknowledgement"><font size="5">Testing of
Acknowledgement.</font></p>
</FIELDSET>
</TD></TABLE>
</CENTER>
<center><input type="submit" value="Submit" /> <INPUT
TYPE="reset"></center>
</form>
</BODY>
</HTML>
validates the checkbox ok, but it always redirects, even if the box
isn't checked...it does alert, but I was hoping that it would stay on
the current page and not redirect unless the box IS checked. I really
can't see what I did wrong. Any and all help would be appreciated.
My code so far is:
<HTML>
<HEAD>
<TITLE>Application</TITLE>
<script type="text/javascript">
function validate()
{
var test=document.getElementById("CCAcknowledgement").checked
submitOK="true"
if (test==false)
{
alert ("To process your information, you must acknowledge that your
credit report will be verified and
analyzed. Please check the appropriate box.")
}
{
window.navigate('index3.html');
}
</script>
</HEAD>
<BODY bgcolor="#3867AD"
onLoad="self.focus();document.Miniapp.FirstName.focus()">
<CENTER>
TEST OF APPLICATION LINK
</CENTER>
<CENTER><TABLE BORDER="0" WIDTH="500"><TD>
<FORM METHOD="POST" ACTION="gdform.asp" name="Miniapp"
ONSUBMIT="validate();">
<input type="hidden" name="subject" value="Application Submission" />
<input type="hidden" name="redirect" value="index3.html" />
<p> </p>
<FIELDSET>
<LEGEND><b>Step Three: Credit Check Acknowledgement</b></LEGEND>
<p><INPUT TYPE="checkbox" id="CCAcknowledgement"
onclick="ToggleCheck()"
name="CCAcknowledgement"><font size="5">Testing of
Acknowledgement.</font></p>
</FIELDSET>
</TD></TABLE>
</CENTER>
<center><input type="submit" value="Submit" /> <INPUT
TYPE="reset"></center>
</form>
</BODY>
</HTML>