Two Laptop Bag*
The moose likes HTML, CSS and JavaScript and the fly likes problem with calling jsp page on evenet onSelect/onClick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem with calling jsp page on evenet onSelect/onClick" Watch "problem with calling jsp page on evenet onSelect/onClick" New topic

problem with calling jsp page on evenet onSelect/onClick

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
I have select(combo box) having differnt values..
I want to call a jsp page as soon as he select an option...
I used onSelect,onClick event bt they are not working..
code is

<select name='orderby' onSelect='this.form.submit()'>
<option value='jobsheet' >Jobsheet</jobsheet>
<option value='date'>Date</jobsheet>
<option value='name'>Name</jobsheet>
<option value='model'>Model</jobsheet>

plz suggest me...
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
onselect is not an event handler of that element.

The event handler you want is onchange.

Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29238

"onSelect" is only valid for inputing in text or textareas.
"onClick" is only valid for buttons, checkboxes and links.

If you are sure the user will only use the mouse to pick an item, you can use "onChange." This will trigger as soon as the user clicks an item.

If you think the user might be using the keyboard, you should use "onBlur." This triggers when the user leaves the field. Here, you will need some javascript to see whether the data changed. You can also write a little JavaScript to merge the two approaches.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: problem with calling jsp page on evenet onSelect/onClick
Similar Threads
Runtime Error in JavaScript
Instantiate object without scriptlet
ComboBox using JSP
Getting value of Disabled field
Using JSTL Data Displayed In Browser Is Getting Fixed To 24576 Bytes(24 KB)