943,544 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 8004
  • PHP RSS
Nov 9th, 2008
0

submit onchange not working

Expand Post »
Why isn't this working????

php Syntax (Toggle Plain Text)
  1. Echo '
  2. <form action="show.php" method="post" onChange="this.form.submit()">
  3. <select>
  4. <option value selected>select</option>
  5. <option value="1">1</option>
  6. <option value="2">2</option>
  7. </select>
  8. </form> ';
Last edited by peter_budo; Nov 10th, 2008 at 7:44 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BillyMako is offline Offline
16 posts
since Jan 2008
Nov 9th, 2008
0

Re: submit onchange not working

the onchange="this.form.submit()" goes in the select tag.
Last edited by kkeith29; Nov 9th, 2008 at 11:09 pm.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Nov 10th, 2008
0

Re: submit onchange not working

if the form has any form field named 'submit' than just rename it to 'submit2' or anything else than 'submit'. run the code.

If it still doesn't works provide more detail about the code.

okay, i agree upon the previous reply.
Last edited by nirbhab; Nov 10th, 2008 at 2:10 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nirbhab is offline Offline
2 posts
since Jun 2008
Nov 10th, 2008
0

Re: submit onchange not working

change ur code with this........
it will work .......
php Syntax (Toggle Plain Text)
  1. echo '
  2. <form action="show.php" method="post" onChange="this.submit()">
  3. <select>
  4. <option value selected>select</option>
  5. <option value="1">1</option>
  6. <option value="2">2</option>
  7. </select>
  8. <input type="submit" value="submit">
  9. </form> ';
Last edited by peter_budo; Nov 10th, 2008 at 7:45 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 12
Solved Threads: 24
Junior Poster
Manuz is offline Offline
122 posts
since Oct 2008
Nov 11th, 2008
0

Re: submit onchange not working

Click to Expand / Collapse  Quote originally posted by Manuz ...
change ur code with this........
it will work .......
php Syntax (Toggle Plain Text)
  1. echo '
  2. <form action="show.php" method="post" onChange="this.submit()">
  3. <select>
  4. <option value selected>select</option>
  5. <option value="1">1</option>
  6. <option value="2">2</option>
  7. </select>
  8. <input type="submit" value="submit">
  9. </form> ';



Replace your Double Quotes by Single Quotes, and vice versa.

php Syntax (Toggle Plain Text)
  1. echo "<form action='show.php' method='post' onChange='this.submit()'><select><option value selected>select</option><option value='1'>1</option><option value='2'>2</option></select><input type='submit' value='submit'></form> ";

Regards...
Last edited by peter_budo; Nov 12th, 2008 at 5:28 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 3
Newbie Poster
sasankasekhar is offline Offline
24 posts
since Jan 2007
Nov 11th, 2008
0

Re: submit onchange not working

Replace your Double Quotes by Single Quotes, and vice versa.

echo "<form action='show.php' method='post' onChange='this.submit()'><select><option value selected>select</option><option value='1'>1</option><option value='2'>2</option></select><input type='submit' value='submit'></form> ";

Regards...
why....that is not necessary.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Nov 15th, 2008
0

Re: submit onchange not working

Click to Expand / Collapse  Quote originally posted by kkeith29 ...
why....that is not necessary.


Sorry .... onChange="this.submit();" goes in the SELECT tag
Reputation Points: 10
Solved Threads: 3
Newbie Poster
sasankasekhar is offline Offline
24 posts
since Jan 2007
Nov 15th, 2008
0

Re: submit onchange not working

Sorry .... onChange="this.submit();" goes in the SELECT tag
i was referring to replacing of the double quotes with single quotes. i was just wondering why you would do that. I really doesn't make much of a difference.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Nov 18th, 2008
0

Re: submit onchange not working

Thank you. My problem was the onchange was in the option not the select. Every other site neglects to mention that.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Yipyo is offline Offline
4 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Learning PHP...
Next Thread in PHP Forum Timeline: dynamic page





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC