Click to See Complete Forum and Search --> : What is wrong with checkbox form?


SchoolMom
02-21-2003, 03:36 PM
What am I doing wrong? I must just not know enough!

This web page is just supposed to check to see if all the boxes are checked. If so then it will load the web page "finished.htm" if any are unchecked then it will show an alert box saying "You need to do more school work."

It does not work.

Why?

Here is the html:



<html>

<head>
<title>School Checklist</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<script language="JavaScript">
<!--

function getAdditionalValue(gp)
{
if (gp.C1.checked == true)
open('finished.htm', "","menubar,status,height=100,width=440,scrollbars,resizable,top=15,left=140")

if (gp.C2.checked == false)
{
alert ("You need to do more school work!")
}

return
}


//-->

</script>
</head>

<body>

<p><!--webbot bot="HTMLMarkup" startspan --></SCRIPT><!--webbot bot="HTMLMarkup" endspan --></p>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><!--webbot bot="SaveResults" endspan --><p><big><big>Hymn
</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Prayer </big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Pledge</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Scriptures</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Flashcards</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Mom Read</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Joshua Read</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>2 Sentences</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Chalkboard Sentence</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Any School Activity</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Any School Activity</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p><big><big>Any School Activity</big></big><input type="checkbox" name="C1" value="ON"> </p>
<p>&nbsp;</p>
<p><!--Submit button--><input type="button" value="Done" onclick="return checkform(this.form)"><input
type="reset" value="Refresh" name="B2"></p>
</form>

<p>&nbsp;</p>
</body>

khalidali63
02-21-2003, 05:33 PM
delete everything between the <script type="text/javascript"> </script> tags

and add this function in between the script tags


function checkform(gp){
var cboxes = gp.C1;
for (n = 0;n<cboxes.length;n++){
if (cboxes[n].checked == false){
cboxes[n].focus()
alert ("You need to do more school work!");
return false;
}
}
window.open('finished.htm', ""," menubar,status,height=100,width=440,scrollbars,resizable,top=15,left=140");
}


the line window.open should be 1 straight line.

cheers

Khalid

SchoolMom
02-21-2003, 09:15 PM
I am trying to learn more so I tried both suggestions. They both work. Thanks.

School Mom:D :D :D