wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes OnChange not firing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "OnChange not firing " Watch "OnChange not firing " New topic
Author

OnChange not firing

Devinder Mahil
Greenhorn

Joined: Dec 19, 2008
Posts: 5
Hi :

I have a form that includes a jsp. In this jsp I have an html:select which has an onchange event which is not firing.



included.jsp



what's wrong with the code?

regards

Devinder
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Have you debugged what is happening?
Are you getting an errors?
Did you stick an alert in the onchange to see if it is firing?
Do you have a submit button named submit? [if you do rename it]
Are you actually changing the selected item? [Picking the same item does not fire the event]

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

SHowing Struts source code in an HTML forum isn't the best approach. It'd be better to show the resulting HTML.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Devinder Mahil
Greenhorn

Joined: Dec 19, 2008
Posts: 5
Thanks Eric. There was a button named "submit" in the form, renaming it worked.

regards

Devinder
stef li
Greenhorn

Joined: Jan 16, 2006
Posts: 27
onchange="this.form.action='/anotherAction.do' this.form.submit();"

that you forget a semicolon between ".do'" and "this"?

you can add a simple alert statement in your onchange function to check it.
like onchange="alert('this is a test');"

i think i will work fine.


This guy is so lazy!!!<br />There is nothing left!
 
jQuery in Action, 2nd edition
 
subject: OnChange not firing
 
Similar Threads
retrieve value of a field
doubt regarding <html:select>
JSP Page when submitted, List becomes empty
enable/disable drop down
Struts: Getting a blank page instead of the form