Dear Mike: Within your Javascript, try to find your drop down by Id or Name. I think the statement looks something like:
mySelectBox = document.findElementById("yourIdHere") or mySelectBox = document.findElementByName("yourIdHere") Hope that helps! Wiwit Tjahjana The information transmitted in this Email is for the exclusive use of the person or entity to which it is addressed and may contain confidential information. If you are not the intended recipient of this Email, you are prohibited from reading, printing, duplicating, disseminating or otherwise using this information. If you have received this information in error, please notify the sender at Freddie Mac immediately, delete this information from your computer, and destroy all copies of the information. "Mike Elliott" <[EMAIL PROTECTED]> 10/06/2004 03:22 PM Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>; Please respond to "Mike Elliott" <[EMAIL PROTECTED]> To "Struts Users Mailing List" <[EMAIL PROTECTED]> cc Subject Modifying an object within the form bean? I have a situation where the form bean contains objects inside it which represent sets of things which will appear in an <html:select> tag. In particular, the objects have three properties: selected_ndx ndx_set label_set One of these objects is the 'moderator' property of the form bean. The overall design intent was to have an object which could provide the values and labels for an <html:select> statement and have selected_ndx be the value which is changed via the selection process in the web page. If I write the JSP like this, it works: <html:select property="moderator.selected_ndx"> <html:options property="moderator.ndx_set" labelProperty="moderator.label_set"/> </html:select> This generates the following HTML: <select name="moderator.selected_ndx"><option value="0"></option> <option value="1">First Selection</option> <option value="2">Second Selection</option> <option value="3">Third Selection</option></select> This successfully displays the selected entity and allows it to be changed via selection through the web page. However, additionally I need to be able to set the value of this select from a popup window. That generally means I need to specify the form element as the target of a javascript assignment. What has worked in similar circumstances in the past is something like opener.document.formBean.selectElementName = newValue where selectElementName is the value of the 'name' attribute from the select element. Here that name is "moderator.selected_ndx". That causes a problem. When the javascript runs (from a popup window) the following javascript error occurs: Error: opener.document.formBean.moderator has no properties Which I interpret as the javascript interpreter being able to find the formBean property (which I assume is being furnished by the <html:form> tag) but that there is no attribute of that called "moderator". If I didn't use the dotted notation in the <html:select> tag, the correct attribute gets created, or whatever, and the javascript works OK. So -- how can I solve this problem? Assuming that the naming is the problem, I've tried introducing a bean like this: <bean:define id="mod" name="formBean" property="moderator"/> <html:select name="mod" property="selected_ndx"> <html:options name="mod" property="ndx_set" labelName="mod" labelProperty="label_set"/> </html:select> Which generates HTML: <select name="selected_ndx"><option value="0"></option> etc. But that causes the select element to be unselectable; that is, while the getter method (getSelected_ndx()) gets invoked, the setter method (setSelected_ndx()) does not, so that changes to the field no longer get propagated back to the form bean. Even if I could get this to work, I'm dubious that I could have multiple select elements working properly in the same form since they would all have the same name attribute (selected_ndx). While I'm unconvinced that the failure to invoke the setter method isn't a bug, I still need to solve the problem through some combination of Struts/JavaScript. Any suggestions? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]