Javascript Form Submit Error - Please HELP!

S

shandain

Ok, I have done this a million times, and I can't get this to work...
I hope I am just being an idiot and missing something... but I can't
see it... so please call me an idiot and tell me what it is...

<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<title>Online Orientation Quiz</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="javascript">
<!--
function myFunction(myRadioGroup,myCorrectAnswer){
var pointValue=0;
var answerChosen=false;
for (var i=0; i<document.myForm[myRadioGroup].length; i++) {
if (document.myForm[myRadioGroup].checked) {
if(document.myForm[myRadioGroup].value==myCorrectAnswer){
answerChosen=true;
//alert(myRadioGroup+' is correct.');
pointValue++;
} else {
pointValue=0;
};
} ;
};
if (!answerChosen){
pointValue=0;
}
return pointValue;
};

function validate()
{
alert(document.forms(0).submit());
}

//-->
</script>
<link href="http://www.fvtc.edu/style.css" rel="stylesheet"
type="text/css">
</HEAD>
<body>
<h2><IMG alt="Orientation Logo"
src="http://www.fvtc.edu/Files/OrietationLogo201-43111414.jpg"
align="right"> Online&nbsp;Orientation Quiz</h2>

<form name="myForm" method=post action="mytarget.html" id="myForm">
<OL>
<li>
Students may access their personal information online through
_____<br>
<br>
<input type="radio" name="radQ1" value="Yahoo" ID="Radio13">
&nbsp;
<label for="Radio13">Yahoo!</label><BR>
<input type="radio" name="radQ1" value="Hotmail" ID="Radio14">
&nbsp;
<label for="Radio14">Hotmail</label><BR>
<input type="radio" name="radQ1" value="MyFVTC" ID="Radio37">
&nbsp;
<label for="Radio37">MyFVTC</label><BR>
<input type="radio" name="radQ1" value="Web Advisor" ID="Radio76">
&nbsp;
<label for="Radio76">Web Advisor</label><BR>
<BR>
<li>
Dropping courses or a program at FVTC is a _____
responsibility.<br>
<br>
<input type="radio" name="radQ2" value="Counselors" ID="Radio1">
&nbsp;
<label for="Radio1">Counselor's</label><BR>
<input type="radio" name="radQ2" value="Students" ID="Radio2">
&nbsp;
<label for="Radio2">Student's</label><BR>
<input type="radio" name="radQ2" value="Registration" ID="Radio3">
&nbsp;
<label for="Radio3">Registration</label><BR>
<input type="radio" name="radQ2" value="Parents" ID="Radio4">
&nbsp;
<label for="Radio4">Parent's</label><BR>
<BR>
<li>
When planning your schedule and for any advice regarding your
program or a
personal nature, you should seek the advice of:<br>
<br>
<input type="radio" name="radQ3" value="Webmaster" ID="Radio5">
&nbsp;
<label for="Radio5">Webmaster</label><BR>
<input type="radio" name="radQ3" value="Dean of Students"
ID="Radio6"> &nbsp;
<label for="Radio6">Dean of Students</label><BR>
<input type="radio" name="radQ3" value="Academic Counselor"
ID="Radio7"> &nbsp;
<label for="Radio7">Academic Counselor</label><BR>
<input type="radio" name="radQ3" value="Another student"
ID="Radio8"> &nbsp;
<label for="Radio8">Another student</label><BR>
<BR>
<li>
A prerequisite is something you must do, or a class you must take,
before you
enroll in the next one that specifically requires it?
<br>
<br>
<input type="radio" name="radQ4" value="True" ID="Radio9"> &nbsp;
<label for="Radio9">True</label><BR>
<input type="radio" name="radQ4" value="False" ID="Radio10">
&nbsp;
<label for="Radio10">False</label><BR>
<BR>
<LI>
As an FVTC student, you are responsible for any communication that
is made
available to you.&nbsp; Important college information will be sent
via:
<br>
<br>
<input type="radio" name="radQ5" value="My home" ID="Radio11">
&nbsp;
<label for="Radio11">My home</label><BR>
<input type="radio" name="radQ5" value="My FVTC e-mail"
ID="Radio12"> &nbsp;
<label for="Radio12">My FVTC e-mail</label><BR>
<input type="radio" name="radQ5" value="My parents" ID="Radio15">
&nbsp;
<label for="Radio15">My parents</label><BR>
<input type="radio" name="radQ5" value="Another student"
ID="Radio16"> &nbsp;
<label for="Radio16">My cell phone</label><BR>
<BR>
<LI>
Student ID's are needed on campus.&nbsp; I can obtain that at:<br>
<br>
<input type="radio" name="radQ6" value="Registration"
ID="Radio17"> &nbsp;
<label for="Radio17">Registration</label><BR>
<input type="radio" name="radQ6" value="Student Life"
ID="Radio18"> &nbsp;
<label for="Radio18">Student Life</label><BR>
<input type="radio" name="radQ6" value="Information Center"
ID="Radio19"> &nbsp;
<label for="Radio19">Information Center</label><BR>
<input type="radio" name="radQ6" value="My classroom"
ID="Radio20"> &nbsp;
<label for="Radio20">My classroom</label><BR>
<BR>
<LI>
If I drop a class, in order to get a 100% refund I will need to
contact
Registration:
<br>
<br>
<input type="radio" name="radQ7" value="The day the class starts"
ID="Radio21">
&nbsp;
<label for="Radio21">The day the class starts</label><BR>
<input type="radio" name="radQ7" value="One business day prior to
the day the class starts"
ID="Radio22"> &nbsp;
<label for="Radio22">One business day prior to the day the class
starts</label><BR>
<input type="radio" name="radQ7" value="Anytime" ID="Radio23">
&nbsp;
<label for="Radio23">Anytime</label><BR>
<BR>
<LI>
If I need to be contacted while in class, an all school page will
be given so I
can pick up a message:<br>
<br>
<input type="radio" name="radQ8" value="True" ID="Radio24"> &nbsp;
<label for="Radio24">True</label><BR>
<input type="radio" name="radQ8" value="False" ID="Radio25">
&nbsp;
<label for="Radio25">False</label><BR>
<BR>
<LI>
Parking at FVTC:<br>
<br>
<input type="radio" name="radQ9" value="Costs $25.00 per year"
ID="Radio26"> &nbsp;
<label for="Radio26">Costs $25.00 per year</label><BR>
<input type="radio" name="radQ9" value="Costs $25.00 each
semester" ID="Radio27">
&nbsp;
<label for="Radio27">Costs $25.00 each semester</label><BR>
<input type="radio" name="radQ9" value="Is free if I park in
student parking" ID="Radio28">
&nbsp;
<label for="Radio28">Is free if I park in student
parking</label><BR>
<input type="radio" name="radQ9" value="None of the above"
ID="Radio29"> &nbsp;
<label for="Radio29">None of the above</label><BR>
<BR>
<LI>
Lost and Found is located in:<br>
<br>
<input type="radio" name="radQ10" value="Student Life"
ID="Radio30"> &nbsp;
<label for="Radio30">Student Life</label><BR>
<input type="radio" name="radQ10" value="Information"
ID="Radio31"> &nbsp;
<label for="Radio31">Information</label><BR>
<input type="radio" name="radQ10" value="Security" ID="Radio32">
&nbsp;
<label for="Radio32">Security</label><BR>
<input type="radio" name="radQ10" value="Financial Aid"
ID="Radio33"> &nbsp;
<label for="Radio33">Financial Aid</label><BR>
<BR>
<LI>
Student Employment Services:<br>
<br>
<input type="radio" name="radQ11" value="Provides information on
jobs available" ID="Radio34">
&nbsp;
<label for="Radio34">Provides information on jobs
available</label><BR>
<input type="radio" name="radQ11" value="Is a resource center for
resume and interviewing tips"
ID="Radio35"> &nbsp;
<label for="Radio35">Is a resource center for resume and
interviewing tips</label><BR>
<input type="radio" name="radQ11" value="Has on campus interviews"
ID="Radio36">
&nbsp;
<label for="Radio36">Has on campus interviews</label><BR>
<input type="radio" name="radQ11" value="All the above"
ID="Radio38"> &nbsp;
<label for="Radio38">All the above</label><BR>
<input type="radio" name="radQ11" value="None of the above"
ID="Radio39"> &nbsp;
<label for="Radio39">None of the above</label><BR>
<BR>
<LI>
Special Needs is where students need to go if they are looking for
peer
tutoring.<br>
<br>
<input type="radio" name="radQ12" value="True" ID="Radio40">
&nbsp;
<label for="Radio40">True</label><BR>
<input type="radio" name="radQ12" value="False" ID="Radio41">
&nbsp;
<label for="Radio41">False</label><BR>
<BR>
<LI>
The Library has:
<br>
<br>
<input type="radio" name="radQ13" value="Rooms for small groups to
meet" ID="Radio42">
&nbsp;
<label for="Radio42">Rooms for small groups to meet</label><BR>
<input type="radio" name="radQ13" value="Internet resources"
ID="Radio43"> &nbsp;
<label for="Radio43">Internet resources</label><BR>
<input type="radio" name="radQ13" value="Resource loans from other
schools" ID="Radio44">
&nbsp;
<label for="Radio44">Resource loans from other schools</label><BR>
<input type="radio" name="radQ13" value="Computer access"
ID="Radio45"> &nbsp;
<label for="Radio45">Computer access</label><BR>
<input type="radio" name="radQ13" value="All of the above"
ID="Radio47"> &nbsp;
<label for="Radio47">All of the above</label><BR>
<input type="radio" name="radQ13" value="None of the above"
ID="Radio46"> &nbsp;
<label for="Radio46">Two of the above</label><BR>
<BR>
<LI>
For fall 2005 classes, my tuition fees are due on:<br>
<br>
<input type="radio" name="radQ14" value="July 27, 2005"
ID="Radio48"> &nbsp;
<label for="Radio30">July 27, 2005</label><BR>
<input type="radio" name="radQ14" value="The first day of class"
ID="Radio49"> &nbsp;
<label for="Radio31">The first day of class</label><BR>
<input type="radio" name="radQ14" value="August 15, 2005"
ID="Radio50"> &nbsp;
<label for="Radio32">August 15, 2005</label><BR>
<input type="radio" name="radQ14" value="June 30, 2005"
ID="Radio51"> &nbsp;
<label for="Radio33">June 30, 2005</label><BR>
<BR>
</LI>
</OL>
<p align="center">
<input type="button" name="submit" value="Submit" ID="Button1"
onclick="validate();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" name="Submit2"
value="Reset" ID="Reset1">
</p>
</form>
<P>&nbsp;</P>
</body>
</HTML>
</code>
 
S

shandain

Ok, that line that says...
alert(document.forms(0).submit())
was at one time...
document.forms(0).submit;
and
document.myForm.submit();

both of which gave me an 'Object does not support this property or
method' error... I really did have that code in there at one time, I
swear it, but that didn't work either
 
M

Matt Kruse

document.forms(0).submit;
document.forms[0].submit();

document.myForm.submit();

document.forms["myForm"].submit();

Both are valid, the second is preferred.
 
S

shandain

I tried both and still get the same error... I created a new document
to try to see if I could get it working... its at

http://deptets.fvtc.edu/tryme.html

very plain... check the lengthof a text box, which it does, but I
still get the same error... Object does not support this property or
method...

BTW, thank you for looking at this with me...


Matt said:
document.forms(0).submit;
document.forms[0].submit();

document.myForm.submit();

document.forms["myForm"].submit();

Both are valid, the second is preferred.
 
M

Matt Kruse

I tried both and still get the same error... I created a new
document to try to see if I could get it working... its at
http://deptets.fvtc.edu/tryme.html

The reason is that your button is named 'submit'.

Try this:

<html>
<head>
<script type="text/javascript">
function validate(){
if(document.forms["myform"].Text1.value.length>0){
document.forms["myform"].submit();
} else {
alert("enter something in the box");
}
}
</script>
</head>
<body>
<form name="myform" action="myfile.html" method="get">
<input type="text" ID="Text1" NAME="Text1"><br>
<input type="button" name="submitButton" value="Submit" ID="Button1"
onclick="validate();">
</form>
</body>
</html>
 
R

RobB

Ok, I have done this a million times, and I can't get this to work...
I hope I am just being an idiot and missing something... but I can't
see it... so please call me an idiot and tell me what it is...

You're an idiot.

OK, so you're *not* an idiot, just trying to be cooperative.

(snip)
<p align="center">
<input type="button" name="submit" value="Submit" ID="Button1"
onclick="validate();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" name="Submit2"
value="Reset" ID="Reset1">

Very common error: you've named your submit button "submit",
overwriting the Form.submit property - which holds the Form.submit()
method. Try something else.

Please don't post tabbed code. Read the faq.
 
S

Shandain

Man, I am an idiot... I even knew that one!! Thank you!!! Sorry
about the code.. Thank you very very much!
 
R

RobB

RobB said:
You're an idiot.

OK, so you're *not* an idiot, just trying to be cooperative.

(snip)


Very common error: you've named your submit button "submit",
overwriting the Form.submit property - which holds the Form.submit()
method. Try something else.

Please don't post tabbed code. Read the faq.

Hmm...just noticed - that isn't a submit button, but a generic button
with its onclick handler wired for submission. Why? Now the js-disabled
crowd loses out. Drop the handler, make it a true submit button, and
call the validator from the form's onsubmit handler:

<form....onsubmit="return validate()">

Presumably you'll want to validate something as well...

(& you're welcome !)
 
M

Mick White

Ok, that line that says...
alert(document.forms(0).submit())
was at one time...
document.forms(0).submit;
and
document.myForm.submit();

both of which gave me an 'Object does not support this property or
method' error... I really did have that code in there at one time, I
swear it, but that didn't work either

Rename your submit button, your references are ambiguous.
Mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top