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
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
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?
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.