This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is onSelect supported by html:select

 
Sam Kaye
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see what you mean. I'll give it a shot. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic