aspose file tools*
The moose likes Struts and the fly likes Is onSelect supported by html:select 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 "Is onSelect supported by html:select" Watch "Is onSelect supported by html:select" New topic
Author

Is onSelect supported by html:select

Sam Kaye
Greenhorn

Joined: Nov 12, 2003
Posts: 6
I am trying to submit a form in struts after a user selects an option from a drop-down list. When I try to use the onSelect field for the SelectTag, jsp throws the error - "Unable to find setter method for attribute: onSelect".
Whats going wrong?
-JS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Welcome to the Ranch Java Sam!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Also, we have a forum completely dedicated to Struts and frameworks so I'm going to move this topic there for you.
Thanks!
bear
JSP Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
If you use the struts form tag, then you need to define a form bean with getter and setters for that form. Have you done this already?
Sam Kaye
Greenhorn

Joined: Nov 12, 2003
Posts: 6
Oh yes, the ActionForm is defined with the getter setters. And this is what I have in the jsp:
<script>
function itemSelected() {
document.form.action="/SubmitSelection.do";
document.form.submit();
}
</script>
<html:select property="selectedIndex" styleId="selIndex" onSelect="itemSelected()">
I tried using another field - "onfocus", and that seems to be working (meaning the event is getting fired). However if I select some option from the list, the onSelect doesnt seem to get fired. Any thoughts?
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
Okay, I understand more now. There is NO onSelect for the html:select tag. There is an "onchange", "onclick", and "ondblclick". The "onchange" might work for you. I've never tried it.
Sam Kaye
Greenhorn

Joined: Nov 12, 2003
Posts: 6
I see what you mean. I'll give it a shot. Thanks!
 
 
subject: Is onSelect supported by html:select