On 12/9/05, Mike Darretta <[EMAIL PROTECTED]> wrote: > I thought I had licked this problem - but it only works with Firefox! > > I have an <html:select> tag that, when a user selects an option, a > submit() is forced through a javascript call. > > The JSP code is: > > <html:select property="selectedAvailableBeans" size="12" multiple="true" > ... > onclick="handleClick(this)"/> > <snip/>
This is a well-known issue. While one would hope that the HTML event processing models would be consistent across all browsers, that is hardly the case. While we patiently wait for that to happen, you should trigger the handler with an onchange event, rather than an onclick, whose more explicit semantics will ensure that you have the correct selectedIndex in your Javascript handler. The saving grace here being that even conceptually, when dealing with <select> elements, you are *almost* always interested in changes, not clicks. -Rahul > The javascript code: > > function handleClick(obj, prefix) { > var F_Obj = obj.form; > index = F_Obj.selectedAvailableBeans.selectedIndex; > ... > > F_Obj.submit(); > } > > This works fine in Firefox, but with IE, the index value is always -1. > > Can anyone help me with the proper way to post the results of a > selection without requiring the user to depress a select button? > > Thanks, > -- > Mike > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]