webent Posted August 25, 2008 Share Posted August 25, 2008 Hi, I was hoping someone could help me out with this problem, I always use this code, so I don't understand why it has just stopped working... Here's just a basic example of what isn't working... <form method="POST" name="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange=form1.submit()> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> </form> I get this "Error on page" and when I expand it, I see this "Error: 'form1' is undefined" Anyone have any idea what could be going on? Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/ Share on other sites More sharing options...
Ken2k7 Posted August 25, 2008 Share Posted August 25, 2008 <form method="POST" name="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange="this.parentNode.parentNode.submit();"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625499 Share on other sites More sharing options...
webent Posted August 26, 2008 Author Share Posted August 26, 2008 <form method="POST" name="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange="this.parentNode.parentNode.submit();"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> </form> That gives me this error... Error: Object doesn't support this property or method Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625559 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 <form method="POST" name="form1" id="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange="document.getElementById('form1').submit();"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625567 Share on other sites More sharing options...
webent Posted August 26, 2008 Author Share Posted August 26, 2008 <form method="POST" name="form1" id="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange="document.getElementById('form1').submit();"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> </form> Same error as the last one DarkWater... Crazy huh? Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625600 Share on other sites More sharing options...
Zane Posted August 26, 2008 Share Posted August 26, 2008 have you tried just submit() Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625601 Share on other sites More sharing options...
Ken2k7 Posted August 26, 2008 Share Posted August 26, 2008 <form method="POST" name="form1" action="index.php"> <p><select size="4" name="Dropdown1" onchange="document.forms.form1.submit();"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select></p> </form> Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625650 Share on other sites More sharing options...
haku Posted August 26, 2008 Share Posted August 26, 2008 The second method that Dark Water gave should have worked. It was correct. Go back and check to make sure you were editing the correct file etc. Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625751 Share on other sites More sharing options...
webent Posted August 26, 2008 Author Share Posted August 26, 2008 @haku Yes, I double checked it, put in a change and it showed up... @everyone else The codes work if I just put them in a plain test page by itself. Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625827 Share on other sites More sharing options...
haku Posted August 26, 2008 Share Posted August 26, 2008 If that works when isolated by itself on a page, but not when inserted in a page with other stuff, it means that you have an error somewhere else in the code on your page that is causing the form not to submit. Dark Water's 2nd solution was correct, so use that and then try to figure out where in your page the error lies. Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625883 Share on other sites More sharing options...
webent Posted August 26, 2008 Author Share Posted August 26, 2008 You got it... I downloaded firefox to see if it was an ie7 problem, but it didn't work with it either... Trying to find the error is like finding a needle in a haystack, I can't imagine what would cause it to throw the error, but I'll keep looking... Here's the site in case anybody wants to take a look, meanwhile I'll keep trying. http://webwiredelectronics.com/ Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625893 Share on other sites More sharing options...
webent Posted August 26, 2008 Author Share Posted August 26, 2008 Got it working, thanks everyone for your help... It was my own stupid fault, I left off the ending form tag from the search box directly before the manufacturer box... Quote Link to comment https://forums.phpfreaks.com/topic/121320-solved-basic-select-onchange-submit-not-working/#findComment-625924 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.