you can do as following. 
 countryCollection is an ArryList with object of struts' LabelValueBean. The value is 
the country code and label is the country name for example.
Once the user changes the country selection, it will submit the change to server so 
that the action can generate the city list based on the selected county. Once it's 
done, forward to itself. The list of city will be populated accordingly. If you want 
use javascript, then it's a different story.

Hope this can help!

<html:select property="selectedCountry" >
<html:options collection="countryCollection"  property="value" labelProperty="label"  
onchange="submit()" />
</html:select>

<html:select property="selectedCity" >
<html:options collection="cityCollection"  property="value" labelProperty="label"  />
</html:select>



Jiin-Her Lu
(816) 926-2145

>>> [EMAIL PROTECTED] 02/02/04 09:49AM >>>
Apologies for this newbie question...

I have 2 selections: Country and City 
I have 2 collections in session (CityList contains a reference to Country)
I don't want the user to select a City before selecting a Country and I want
to display a list of Cities that relate to the selected Country...

Can anyone please help with this code:

  ...
  <tr>
    <td>Country</td>
    <td>
      <html:select property="country"
onchange="document.forms['myForm'].city.value='';
 
document.forms['myForm'].submit();">
        <html:option value="">Select a country...</html:option>
        <html:options collection="CountryList" property="country"
labelProperty="description" />
      </html:select>
      <font color="red"><html:errors property="country" /></font>
    </td>
  </tr>
  <tr>
    <td>City</td>
    <td>
      <html:select property="city">
        <html:option value="">Select a city...</html:option>
        <logic:iterate id="City" name="CityList" property="list"
type="City">
<<<<<-----------------------------------------------------------------------
------
          <logic:equal name="City" property="country" value="">
!!! This is where I'm stumped. How do I get the comparison to work between 2
beans?
>>>>>-----------------------------------------------------------------------
------
            <html:option name="City" property="city"
labelProperty="description" />
          </logic:equals >

        </logic:iterate>
      </html:select>
      <font color="red"><html:errors property="city" /></font>
    </td>
  </tr>
  ...

Any help much appreciated!
Derek



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