Javascript Form Submit Error - Please HELP!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shandain@gmail.com

    #1

    Javascript Form Submit Error - Please HELP!

    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="javas cript">
    <!--
    function myFunction(myRa dioGroup,myCorr ectAnswer){
    var pointValue=0;
    var answerChosen=fa lse;
    for (var i=0; i<document.myFo rm[myRadioGroup].length; i++) {
    if (document.myFor m[myRadioGroup][i].checked) {
    if(document.myF orm[myRadioGroup][i].value==myCorre ctAnswer){
    answerChosen=tr ue;
    //alert(myRadioGr oup+' 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="Orientatio n Logo"
    src="http://www.fvtc.edu/Files/OrietationLogo2 01-43111414.jpg"
    align="right"> Online&nbsp;Ori entation Quiz</h2>

    <form name="myForm" method=post action="mytarge t.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">Y ahoo!</label><BR>
    <input type="radio" name="radQ1" value="Hotmail" ID="Radio14">
    &nbsp;
    <label for="Radio14">H otmail</label><BR>
    <input type="radio" name="radQ1" value="MyFVTC" ID="Radio37">
    &nbsp;
    <label for="Radio37">M yFVTC</label><BR>
    <input type="radio" name="radQ1" value="Web Advisor" ID="Radio76">
    &nbsp;
    <label for="Radio76">W eb Advisor</label><BR>
    <BR>
    <li>
    Dropping courses or a program at FVTC is a _____
    responsibility. <br>
    <br>
    <input type="radio" name="radQ2" value="Counselo rs" ID="Radio1">
    &nbsp;
    <label for="Radio1">Co unselor's</label><BR>
    <input type="radio" name="radQ2" value="Students " ID="Radio2">
    &nbsp;
    <label for="Radio2">St udent's</label><BR>
    <input type="radio" name="radQ2" value="Registra tion" ID="Radio3">
    &nbsp;
    <label for="Radio3">Re gistration</label><BR>
    <input type="radio" name="radQ2" value="Parents" ID="Radio4">
    &nbsp;
    <label for="Radio4">Pa rent'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="Webmaste r" ID="Radio5">
    &nbsp;
    <label for="Radio5">We bmaster</label><BR>
    <input type="radio" name="radQ3" value="Dean of Students"
    ID="Radio6"> &nbsp;
    <label for="Radio6">De an of Students</label><BR>
    <input type="radio" name="radQ3" value="Academic Counselor"
    ID="Radio7"> &nbsp;
    <label for="Radio7">Ac ademic Counselor</label><BR>
    <input type="radio" name="radQ3" value="Another student"
    ID="Radio8"> &nbsp;
    <label for="Radio8">An other 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">Tr ue</label><BR>
    <input type="radio" name="radQ4" value="False" ID="Radio10">
    &nbsp;
    <label for="Radio10">F alse</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">M y home</label><BR>
    <input type="radio" name="radQ5" value="My FVTC e-mail"
    ID="Radio12"> &nbsp;
    <label for="Radio12">M y FVTC e-mail</label><BR>
    <input type="radio" name="radQ5" value="My parents" ID="Radio15">
    &nbsp;
    <label for="Radio15">M y parents</label><BR>
    <input type="radio" name="radQ5" value="Another student"
    ID="Radio16"> &nbsp;
    <label for="Radio16">M y 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="Registra tion"
    ID="Radio17"> &nbsp;
    <label for="Radio17">R egistration</label><BR>
    <input type="radio" name="radQ6" value="Student Life"
    ID="Radio18"> &nbsp;
    <label for="Radio18">S tudent Life</label><BR>
    <input type="radio" name="radQ6" value="Informat ion Center"
    ID="Radio19"> &nbsp;
    <label for="Radio19">I nformation Center</label><BR>
    <input type="radio" name="radQ6" value="My classroom"
    ID="Radio20"> &nbsp;
    <label for="Radio20">M y 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">T he 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">O ne business day prior to the day the class
    starts</label><BR>
    <input type="radio" name="radQ7" value="Anytime" ID="Radio23">
    &nbsp;
    <label for="Radio23">A nytime</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">T rue</label><BR>
    <input type="radio" name="radQ8" value="False" ID="Radio25">
    &nbsp;
    <label for="Radio25">F alse</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">C osts $25.00 per year</label><BR>
    <input type="radio" name="radQ9" value="Costs $25.00 each
    semester" ID="Radio27">
    &nbsp;
    <label for="Radio27">C osts $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">I s 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">N one 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">S tudent Life</label><BR>
    <input type="radio" name="radQ10" value="Informat ion"
    ID="Radio31"> &nbsp;
    <label for="Radio31">I nformation</label><BR>
    <input type="radio" name="radQ10" value="Security " ID="Radio32">
    &nbsp;
    <label for="Radio32">S ecurity</label><BR>
    <input type="radio" name="radQ10" value="Financia l Aid"
    ID="Radio33"> &nbsp;
    <label for="Radio33">F inancial 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">P rovides 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">I s 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">H as on campus interviews</label><BR>
    <input type="radio" name="radQ11" value="All the above"
    ID="Radio38"> &nbsp;
    <label for="Radio38">A ll the above</label><BR>
    <input type="radio" name="radQ11" value="None of the above"
    ID="Radio39"> &nbsp;
    <label for="Radio39">N one 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">T rue</label><BR>
    <input type="radio" name="radQ12" value="False" ID="Radio41">
    &nbsp;
    <label for="Radio41">F alse</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">R ooms for small groups to meet</label><BR>
    <input type="radio" name="radQ13" value="Internet resources"
    ID="Radio43"> &nbsp;
    <label for="Radio43">I nternet resources</label><BR>
    <input type="radio" name="radQ13" value="Resource loans from other
    schools" ID="Radio44">
    &nbsp;
    <label for="Radio44">R esource loans from other schools</label><BR>
    <input type="radio" name="radQ13" value="Computer access"
    ID="Radio45"> &nbsp;
    <label for="Radio45">C omputer access</label><BR>
    <input type="radio" name="radQ13" value="All of the above"
    ID="Radio47"> &nbsp;
    <label for="Radio47">A ll of the above</label><BR>
    <input type="radio" name="radQ13" value="None of the above"
    ID="Radio46"> &nbsp;
    <label for="Radio46">T wo 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">J uly 27, 2005</label><BR>
    <input type="radio" name="radQ14" value="The first day of class"
    ID="Radio49"> &nbsp;
    <label for="Radio31">T he first day of class</label><BR>
    <input type="radio" name="radQ14" value="August 15, 2005"
    ID="Radio50"> &nbsp;
    <label for="Radio32">A ugust 15, 2005</label><BR>
    <input type="radio" name="radQ14" value="June 30, 2005"
    ID="Radio51"> &nbsp;
    <label for="Radio33">J une 30, 2005</label><BR>
    <BR>
    </LI>
    </OL>
    <p align="center">
    <input type="button" name="submit" value="Submit" ID="Button1"
    onclick="valida te();">
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; <input type="reset" name="Submit2"
    value="Reset" ID="Reset1">
    </p>
    </form>
    <P>&nbsp;</P>
    </body>
    </HTML>
    </code>

  • shandain@gmail.com

    #2
    Re: Javascript Form Submit Error - Please HELP!

    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

    Comment

    • Matt Kruse

      #3
      Re: Javascript Form Submit Error - Please HELP!

      shandain@gmail. com wrote:[color=blue]
      > document.forms( 0).submit;[/color]

      document.forms[0].submit();
      [color=blue]
      > document.myForm .submit();[/color]

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

      Both are valid, the second is preferred.

      --
      Matt Kruse



      Comment

      • shandain@gmail.com

        #4
        Re: Javascript Form Submit Error - Please HELP!

        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



        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 Kruse wrote:[color=blue]
        > shandain@gmail. com wrote:[color=green]
        > > document.forms( 0).submit;[/color]
        >
        > document.forms[0].submit();
        >[color=green]
        > > document.myForm .submit();[/color]
        >
        > document.forms["myForm"].submit();
        >
        > Both are valid, the second is preferred.
        >
        > --
        > Matt Kruse
        > http://www.JavascriptToolbox.com[/color]

        Comment

        • RobB

          #5
          Re: Javascript Form Submit Error - Please HELP!



          shandain@gmail. com wrote:[color=blue]
          > 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...[/color]

          You're an idiot.

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

          (snip)
          [color=blue]
          > <p align="center">
          > <input type="button" name="submit" value="Submit" ID="Button1"
          > onclick="valida te();">
          > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; <input type="reset" name="Submit2"
          > value="Reset" ID="Reset1">[/color]

          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.

          Comment

          • Shandain

            #6
            Re: Javascript Form Submit Error - Please HELP!

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

            Comment

            • RobB

              #7
              Re: Javascript Form Submit Error - Please HELP!



              RobB wrote:[color=blue]
              > shandain@gmail. com wrote:[color=green]
              > > 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...[/color]
              >
              > You're an idiot.
              >
              > OK, so you're *not* an idiot, just trying to be cooperative.
              >
              > (snip)
              >[color=green]
              > > <p align="center">
              > > <input type="button" name="submit" value="Submit" ID="Button1"
              > > onclick="valida te();">
              > > &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; <input type="reset" name="Submit2"
              > > value="Reset" ID="Reset1">[/color]
              >
              > 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.[/color]

              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....onsubm it="return validate()">

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

              (& you're welcome !)

              Comment

              • Matt Kruse

                #8
                Re: Javascript Form Submit Error - Please HELP!

                shandain@gmail. com wrote:[color=blue]
                > 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[/color]

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

                Try this:

                <html>
                <head>
                <script type="text/javascript">
                function validate(){
                if(document.for ms["myform"].Text1.value.le ngth>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"><b r>
                <input type="button" name="submitBut ton" value="Submit" ID="Button1"
                onclick="valida te();">
                </form>
                </body>
                </html>


                --
                Matt Kruse



                Comment

                • Mick White

                  #9
                  Re: Javascript Form Submit Error - Please HELP!

                  shandain@gmail. com wrote:[color=blue]
                  > 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
                  >[/color]

                  Rename your submit button, your references are ambiguous.
                  Mick

                  Comment

                  Working...