Jump to content

[SOLVED] Basic select onchange submit not working


webent

Recommended Posts

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?

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

<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?

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.