aspose file tools*
The moose likes Struts and the fly likes onSelect attribute for html:select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "onSelect attribute for html:select tag" Watch "onSelect attribute for html:select tag" New topic
Author

onSelect attribute for html:select tag

M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
Hi all,

Whats the html:select equivalent of onselect attribute of select tag?
I went through all the attributes for html:select but there doesnt seem to be one for onselect functionality.


Sindhu Murthy<br />SCJP 1.4<br />SCBCD
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
onselect? I think you're looking for onclick
M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
What I am trying to achieve is everytime a user selects any of the options, I want to invoke a javascript, and depending on the value selected the javascript performs differently.
The problem with using onclick is that, it does not allow the user to select a particular value, instead when a user just clicks on the the drop down list the javascript gets called.
Ilja Smoli
Ranch Hand

Joined: Dec 02, 2001
Posts: 64
Hi
Im afraid onselect atrribute is only for textareas and text input types...
Look at html reference..

Btw you can use
[ December 21, 2004: Message edited by: Ilja Smoli ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onclick does not fire for tab events, you want to look at:

onchange
or
onblur

Eric
M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
calling a javascript in onchange in html:select works.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: onSelect attribute for html:select tag