Thanks a lot for your help, I have a last small question 

To not have to call the server when the user select an new entry*in the
first
combo-box I have to add JavaScript code as indicated in your preceding mails

but I must also place the collections in the HttpSession or Servlet Context
(if
the collection is the same for all clients) and not in the request. 
Is it true ?

Sandra

-----Original Message-----
From: Eric C. Hein [mailto:[EMAIL PROTECTED]]
Sent: 30 January 2003 19:08
To: Struts Users Mailing List
Subject: Re: how to use two combo-box which depend one on the other ?


Sandra,

This works with the javascript code Chris pointed you to.  The
communityIssue is the parent field and there are two dependent fields
(targetAudience & activityType).

- Eric


<td>
<html:select property="communityIssue" styleClass="select" size="10"
multiple="true" tabindex="11"
         onchange="fillSelectFromArray(this.form.communityIssue,
this.form.targetAudience, ((this.selectedIndex == -1) ? null : audiences));
                        fillSelectFromArray(this.form.communityIssue,
this.form.activityType, ((this.selectedIndex == -1) ? null : activities));">
      <html:options collection="communityIssueList" property="value"
labelProperty="label"/>
   </html:select>
</td>


Here is the javascript and STRUTS code to write the array into the page:

<script language="javascript">
audiences = new Array(
   <bean:write name="targetAudienceJSArray" filter="false"/>
);
activities = new Array(
   <bean:write name="activityTypesJSArray" filter="false"/>
);
</script>


----- Original Message -----
From: "Heligon Sandra" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 8:41 AM
Subject: RE: how to use two combo-box which depend one on the other ?


> Do you have an example of this with the struts tags
> that allows to display combo-box from a collection of JavaBeans
> <html:select ...>
>   <html:option >  </html:option>
>
> Sandra
>
> -----Original Message-----
> From: Chris Halverson [mailto:[EMAIL PROTECTED]]
> Sent: 30 January 2003 17:29
> To: Struts Users Mailing List
> Subject: Re: how to use two combo-box which depend one on the other ?
>
>
> Heligon Sandra <[EMAIL PROTECTED]> writes:
>
> > Do I have to ask the web server each time the user select a new
> > function, or is it possible to do this logic on the client side
> > (with JavaScript probably ???).
>
> Yep, w/ JavaScript. I just did this and used the basic functions found
> at:
>
> http://javascript.internet.com/forms/auto-drop-down.html
>
> You have to populate the arrays from your servlet code, but it's
> pretty straightforward.
>
> cdh
>
> --
> Chris D. Halverson                         http://www.halverson.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to