submit onchange not working

Reply

Join Date: Jan 2008
Posts: 16
Reputation: BillyMako is an unknown quantity at this point 
Solved Threads: 0
BillyMako BillyMako is offline Offline
Newbie Poster

submit onchange not working

 
0
  #1
Nov 9th, 2008
Why isn't this working????

  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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: submit onchange not working

 
0
  #2
Nov 9th, 2008
the onchange="this.form.submit()" goes in the select tag.
Last edited by kkeith29; Nov 9th, 2008 at 11:09 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: nirbhab is an unknown quantity at this point 
Solved Threads: 0
nirbhab's Avatar
nirbhab nirbhab is offline Offline
Newbie Poster

Re: submit onchange not working

 
0
  #3
Nov 10th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 61
Reputation: Manuz is an unknown quantity at this point 
Solved Threads: 8
Manuz's Avatar
Manuz Manuz is offline Offline
Junior Poster in Training

Re: submit onchange not working

 
0
  #4
Nov 10th, 2008
change ur code with this........
it will work .......
  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.
Sharing Knowledge Is Better Than Any Other Thingz
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 24
Reputation: sasankasekhar is an unknown quantity at this point 
Solved Threads: 3
sasankasekhar's Avatar
sasankasekhar sasankasekhar is offline Offline
Newbie Poster

Re: submit onchange not working

 
0
  #5
Nov 11th, 2008
Originally Posted by Manuz View Post
change ur code with this........
it will work .......
  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.

  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.
IF SOMEONE FEELS THAT THEY HAD NEVER MADE A MISTAKE IN THEIR LIFE, THEN  IT MEANS THEY HAD NEVER TRIED A NEW THING IN THEIR LIFE
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: submit onchange not working

 
0
  #6
Nov 11th, 2008
Originally Posted by sasankasekhar View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 24
Reputation: sasankasekhar is an unknown quantity at this point 
Solved Threads: 3
sasankasekhar's Avatar
sasankasekhar sasankasekhar is offline Offline
Newbie Poster

Re: submit onchange not working

 
0
  #7
Nov 15th, 2008
Originally Posted by kkeith29 View Post
why....that is not necessary.


Sorry .... onChange="this.submit();" goes in the SELECT tag
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: submit onchange not working

 
0
  #8
Nov 15th, 2008
Originally Posted by sasankasekhar View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 4
Reputation: Yipyo is an unknown quantity at this point 
Solved Threads: 0
Yipyo Yipyo is offline Offline
Newbie Poster

Re: submit onchange not working

 
0
  #9
Nov 18th, 2008
Thank you. My problem was the onchange was in the option not the select. Every other site neglects to mention that.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC