wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

problem with calling jsp page on evenet onSelect/onClick

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
hi
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>
</select>

plz suggest me...
thankx..
Eric Pascarello
author
Rancher

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

The event handler you want is onchange.

Eric
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149

Chango,
"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
 
 
subject: problem with calling jsp page on evenet onSelect/onClick
 
Similar Threads
Using JSTL Data Displayed In Browser Is Getting Fixed To 24576 Bytes(24 KB)
Getting value of Disabled field
Runtime Error in JavaScript
Instantiate object without scriptlet
ComboBox using JSP