Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

submit() method failure.. Help plz (im getting crazy)

edited August 2007 in Vanilla 1.0 Help
ok,, this is a regular checking script, which ive coded many times..

<script type="text/javascript"> function accept () { f=document.forms['order_form']; i=f.elements['check_i']; e=f.elements['check_e']; t=f.elements['check_t']; if ((i.checked)&&(e.checked)&&(t.checked)) { f.submit(); } else { alert('HELP!'); } } </script> <form id="order_form" meth....> <table with input elements...> <button type="button" onclick="accept()">Submit</button> </form>

What is wrong here? Firebug says "f.submit is not a function" ... im going crazy.. .help

Comments

  • Options
    ithcyithcy New
    edited August 2007
    you need to post the real code, not made up stuff like <button type="button">
  • Options
    actually, just change the function name to something other than accept(). javascript doesn't seem to like that word for some reason.
  • Options
    here is the actual snippet:

    <form id="order_form" name="order_form" action="order.php" method="post"> <div class="block_wrapper"> <input type="hidden" name="submit" value="1" /> <table> <tbody> <col width="35%" /> <col width="65%" /> <tr> <td style="text-align:right"><label for="title">Title</label></td> <td style="text-align:left"><input type="text" name="title" id="title" size="40" maxlenght="255" value="" /></td> </tr> <tr> <td style="text-align:right"><label for="due_date">Delivery Mode</label></td> <td style="text-align:left"> <select name="due_date" id="due_date"> <option value="1">Within 4-5 days ($12.95 / page)</option><option value="2">Within 48 hours ($17.95 / page)</option><option value="3">Within 24 hours ($22.95 / page)</option><option value="4">Within 12 hours ($27.95 / page)</option><option value="5">Within 6 hours ($36.95 / page)</option> </select> </td> </tr> <tr> <td style="text-align:right"><label for="num_pages">Number of Pages</label></td> <td style="text-align:left"> <select name="num_pages" id="num_pages"> <option value="0"></option> <option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option><option value="32">32</option><option value="33">33</option><option value="34">34</option><option value="35">35</option><option value="36">36</option><option value="37">37</option><option value="38">38</option><option value="39">39</option><option value="40">40</option><option value="41">41</option><option value="42">42</option><option value="43">43</option><option value="44">44</option><option value="45">45</option><option value="46">46</option><option value="47">47</option><option value="48">48</option><option value="49">49</option><option value="50">50</option><option value="51">51</option><option value="52">52</option><option value="53">53</option><option value="54">54</option><option value="55">55</option><option value="56">56</option><option value="57">57</option><option value="58">58</option><option value="59">59</option><option value="60">60</option> </select>&nbsp; (about 250 words per page) </td> </tr> <tr> <td style="text-align:right"><label for="num_sources">Number of Sources</label></td> <td style="text-align:left"> <select name="num_sources" id="num_sources"> <option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option> </select> </td> </tr> <tr> <td style="text-align:right"><label for="cit_style">Citation Style</label></td> <td style="text-align:left"> <select name="cit_style" id="cit_style"> <option value="0">Any</option> <option value="1">MLA</option><option value="2">APA</option><option value="3">AMA</option><option value="4">Harvard</option><option value="5">Turabian</option> </select> </td> </tr> <tr> <td style="text-align:right"><label for="acad_level">Academic Level</label></td> <td style="text-align:left"> <select name="acad_level" id="acad_level"> <option value="0">Does not matter</option> <option value="1">High School</option><option value="2">College</option><option value="3">University</option> </select> </td> </tr> <tr> <td style="text-align:right"><label for="font_face">Font Face</label></td> <td style="text-align:left"> <select name="font_face" id="font_face"> <option value="1">Courier New</option><option value="2">Verdana</option><option value="3">Arial</option> </select> </td> </tr> <tr> <td style="text-align:right"><label for="course">Course/Subject</label></td> <td style="text-align:left"><input type="text" name="course" id="course" size="40" maxlenght="255" value="" /></td> </tr> <tr> <td style="text-align:right"><label for="description">Instructions</label><br /><small>(no contact data here, please)</small></td> <td style="text-align:left"><textarea name="description" id="description" rows="5" cols="40"></textarea></td> </tr> <tr> <td style="text-align:right"><label for="full_name">Full Name</label></td> <td style="text-align:left"><input type="text" name="full_name" id="full_name" size="40" maxlenght="255" value="" /></td> </tr> <tr> <td style="text-align:right" valign="top"><label for="email">E-mail</label></td> <td style="text-align:left"><input type="text" name="email" id="email" size="40" maxlenght="64" value="" /><br /><small><b>Important</b>: make sure you add <b>admin[at]newavessays.com</b> to your address book or you may not receive our messages</small></td> </tr> <tr> <td style="text-align:right"><label for="reqread">Do we have to read specific literature?</label> <b class="error">*</b></td> <td style="text-align:left"><input type="checkbox" name="reqread" id="reqread" /> check if yes</td> </tr> <tr> <td align="left" colspan="2"> <!--By proceding, you accept our <a href="disclaimer.php" style="margin-right: 22px" title="opens in new window"" target="_blank">terms of service <img style="display: inline; position: relative; bottom: 0" src="/images/popup.gif" alt="opens in new window" /></a> <button type="submit">Preview &raquo;</button>--> <script type="text/javascript"> function accept_terms () { f=document.forms['order_form']; i=f.elements['check_i']; e=f.elements['check_e']; t=f.elements['check_t']; if ((i.checked)&&(e.checked)&&(t.checked)) { f.submit(); } else { alert('Before placing your order, you should digitally sign/verify that: \n1. Instructions are ample for your paper \n2. You have added admin[at]newavessays.com to your address book, and \n3. You have read and accept our terms of sale'); } } </script> <button id="submitter" onclick="accept_terms()" type="button" style="float:right; margin-top: 20px">Preview &raquo;</button> <input type="checkbox" name="check_i" id="check_i" /> <label for="check_i">I understand that the instruction above is enough to complete the paper</label><br /> <input type="checkbox" name="check_e" id="check_e" /> <label for="check_e">I have added admin[at]newavessays.com to my address book</label><br /> <input type="checkbox" name="check_t" id="check_t" /> <label for="check_t">I have read and accept the <a href="disclaimer.php" style="margin-right: 22px" title="opens in new window" target="_blank">terms of service <img style="display: inline; position: relative; bottom: 0" src="/images/popup.gif" alt="opens in new window" /></a></label><br /> </td> </tr> </tbody> </table> </div> </form>
  • Options
    ithcy 4 hours ago
    actually, just change the function name to something other than accept(). javascript doesn't seem to like that word for some reason.
  • Options
    i don't think that accept in the function name is a problem.. I have tested and outputed f.innerHTML instead of f.submit() and the alrt worked fine.. moreover, I have renamed the function to check_terms() and the same problem persists... any ideas?
  • Options
    wait a minute... why do you have this in there?
    <input type="hidden" name="submit" value="1" />
    that is going to override the form's submit() method. get rid of it and it should work.
  • Options
    oh... i guess you are right... it distorts the DOM, making <tt>submit</tt> an element rather than method.. lol... thanks
This discussion has been closed.