ThunderAI Posted November 3, 2012 Share Posted November 3, 2012 Something has gone very wrong with Google Chrome as of late or I'm missing something. Something that I know worked not too long ago now doesn't work at all and produced an error message that makes no sense to me. <form style="margin: 0px; margin-bottom:0px; margin-top:-1px;" name="menuitem_home" id="menuitem_home" method="POST" action="index.php" /> <input type="hidden" name="menuitemid" value="index.php" /> <table class="Navigationv5table" border="0" cellpadding="1" cellspacing="1" width="<?php echo $icons_width;?>" height="<?php echo $icons_height;?>" onclick="javascript:document.menuitem_home.submit();toggle('navigationdisplaypanel');" /> <tr> <td width="100%" height="100%" align="center" valign="middle"> <img src="images/_interface/menu_icon_home.png"> </td> </tr> <tr> <td align="center" valign="middle"> <font size="3" color="#FFFFFF"> Home </font> </td> </tr> </table> </form> When you click on the table the form should submit, but i get the error. The only way around the error is to create a submit button and click on it. That wont work for what I want to do here and this used to work. What is going on to cause it to generate the error: Uncaught TypeError: Object #<HTMLCollection> has no method 'submit' Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/ Share on other sites More sharing options...
requinix Posted November 3, 2012 Share Posted November 3, 2012 Is there a URL you can share? Or how about posting the entire HTML? Are you sure there's only one element with name=menuitem_home? Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1389840 Share on other sites More sharing options...
ThunderAI Posted November 3, 2012 Author Share Posted November 3, 2012 (edited) Yes there is only one menuitem_home. Edited November 3, 2012 by ThunderAI Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1389929 Share on other sites More sharing options...
ThunderAI Posted November 3, 2012 Author Share Posted November 3, 2012 Yes there is only one menuitem_home. Did something recently change where you MUST call submit by the form ID? this works: document.getElementById('redirect_form_3').submit(); but this wont document.redirect_form_3.submit(); also, this has a really odd consequence in that form targets to new windows wont work. it will ALWAYS go to a new tab regardless s of what I tell it to do. BUT if I click an actual form submit button i will get the window in the right location and proper window size Here is the window problem that will produce two windows function openmapchild(file,window) { childWindow=open(file,window,'status=1,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=700,width=800'); if (childwindow.opener == null) childwindow.opener = self; } <form style="margin-bottom:0;" action="<?php echo $functionworkorderpage;?>" method="POST" name="Workorderreportform" id="Workorderreportform" target="ViewWorkOrder" onsubmit="openmapchild('<?php echo $functionworkorderpage;?>','ViewWorkOrder');" > <input type="hidden" NAME="recordid" ID="recordid" value="<?php echo $disid;?>"> <table border="0" cellpadding="0" cellspacing="0" class="table_bottom_right_container_button" /> <tr> <td class="table_button_bullet_right_dark1_normal" onclick="javascript:document.getElementById('Workorderreportform').submit();" /> </td> <td class="table_button_bullet_lead_dark1_normal" /> <input type="submit" value="Work Order" width="10" class="table_button_bullet_lead_dark1_normal"> </td> <td class="table_button_bullet_gap_dark1_normal" onmouseover="ddrivetip('Open Work-Order');" onmouseout="hideddrivetip();"/> <span class="table_button_bullet_input_dark1_normal"> WO </span> </td> <td class="table_button_bullet_tail_dark1_normal" onmouseover="ddrivetip('Open Work-Order');" onmouseout="hideddrivetip();"/> </td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1389930 Share on other sites More sharing options...
kicken Posted November 3, 2012 Share Posted November 3, 2012 Yes there is only one menuitem_home. Did something recently change where you MUST call submit by the form ID? Not as far as I know, but using the ID and getElementById would be a preferred/more proper way of doing it anyway. also, this has a really odd consequence in that form targets to new windows wont work. Calling .submit() does not cause the onsubmit event to be executed. You have to run that code manually prior to calling the .submit function. Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1389984 Share on other sites More sharing options...
ThunderAI Posted November 3, 2012 Author Share Posted November 3, 2012 How would I do that? onsubmit="openchild600('<?php echo $functionpage;?>','MarkasArchieved')" How would I do that before submit and then have the form submit to that new window? Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1390026 Share on other sites More sharing options...
haku Posted November 4, 2012 Share Posted November 4, 2012 (edited) Calling .submit() does not cause the onsubmit event to be executed. On the contrary, it does (jQuery): .submit( handler(eventObject) ) Returns: jQueryDescription: Bind an event handler to the "submit" Javascript event, or trigger that event on an element. http://api.jquery.com/submit/ Edited November 4, 2012 by haku Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1390067 Share on other sites More sharing options...
Jessica Posted November 4, 2012 Share Posted November 4, 2012 OR trigger the event. If you call submit() with NO argument, it triggers it. Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1390095 Share on other sites More sharing options...
ThunderAI Posted November 4, 2012 Author Share Posted November 4, 2012 OR trigger the event. If you call submit() with NO argument, it triggers it. can you provide an example? Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1390098 Share on other sites More sharing options...
Jessica Posted November 4, 2012 Share Posted November 4, 2012 It shows you on the jQuery page. http://api.jquery.com/submit/ I didn't read the whole thread, I'm just clarifying that one point. It says right at the top: This method is a shortcut for .bind('submit', handler) in the first variation, and .trigger('submit') in the third. Quote Link to comment https://forums.phpfreaks.com/topic/270234-uncaught-typeerror-object-has-no-method-submit/#findComment-1390099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.