• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is onSelect supported by html:select

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see what you mean. I'll give it a shot. Thanks!
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic