Re: html:select and submit
What are you actually trying to send? The selected value or the index of the selected item? I also note you have multiple=true... so you expect that more than one can be selected? I'm not sure if that has a bearing on the selectedIndex (I could see where it might), and even if it does, the handler code wouldn't seem to account for that. Frank Mike Darretta 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)/ 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, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and submit
You're right - the multiple=true was wrong, but that was essentially ignored since I am capturing the onclick event. What I want to send is the index to use in extracting the appropriate info from the underlying collection. Anyhow, what I am wanting to do is capture the selected index, then issue a submit() request. Ironically, if I have this: index = F_Obj.selectedAvailableBeans.selectedIndex; index = F_Obj.selectedAvailableBeans.selectedIndex; the second assignment (sometimes!) captures the correct index value. Again, this race condition only occurs when using IE. Mike Frank W. Zammetti wrote: What are you actually trying to send? The selected value or the index of the selected item? I also note you have multiple=true... so you expect that more than one can be selected? I'm not sure if that has a bearing on the selectedIndex (I could see where it might), and even if it does, the handler code wouldn't seem to account for that. Frank Mike Darretta 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)/ 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, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Darretta Computer Sciences Corporation (CSC) Sr. Software Engineer (o) 831.656.4324 (c) 209.814.2774 [EMAIL PROTECTED] This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and submit
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]
Re: html:select and submit
On 12/9/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: What are you actually trying to send? The selected value or the index of the selected item? I also note you have multiple=true... so you expect that more than one can be selected? I'm not sure if that has a bearing on the selectedIndex (I could see where it might), and even if it does, the handler code wouldn't seem to account for that. snip/ In a multiple select, selectName.selectedIndex will always be the index of the *first* selection, if there are one or more (or -1 if there are none). -Rahul Frank Mike Darretta 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)/ 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, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and submit
Thank you, Rahul. This *is* the problem. Much regards (and much better sleep this weekend!)... Mike Rahul Akolkar wrote: 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] -- Mike Darretta Computer Sciences Corporation (CSC) Sr. Software Engineer (o) 831.656.4324 (c) 209.814.2774 [EMAIL PROTECTED] This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and submit
Rahul Akolkar wrote: In a multiple select, selectName.selectedIndex will always be the index of the *first* selection, if there are one or more (or -1 if there are none). Cool, that's what I thought but wasn't sure, you saved me from having to test it :) I think Mike has the answer I wa about to give as well... onChange should do the trick. Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]