Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with calling jsp page on evenet onSelect/onClick

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onselect is not an event handler of that element.

The event handler you want is onchange.

Eric
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic