1 Reply Latest reply on Apr 5, 2008 8:33 PM by Pete Muir

    Need help populating a select

    Eniko zsido Newbie


      I need to resolve the following issue:
      I have 2 selects, the first containing cities, the other postal codes. Both selects are required on form submission.
      When I select a city the second select needs to be populated with codes depending on what city was selected.

      I've tried the following way:

      <h:selectOneMenu id="cities" tabindex="28"  value="#{registerAction.selectedCity}" valueChangeListener="#{registerAction.setPostalCode}" immediate="true"  required="true">
           <s:selectItems value="#{cities}" var="city" label="#{city}" noSelectionLabel="-- please select --" />
            <a:support  event="onchange" reRender="postalCode" immediate="true" />
      <a:outputPanel id="postalCode">
      <h:selectOneMenu id="postalCodes" value="#{registration.person.postalCode}" tabindex="30" required="true">
           <s:selectItems value="#{postalCodes}" var="postalCode" label="#{postalCode.code}" noSelectionLabel="-- please select --" />
            <f:converter converterId="postalCodeConverter" />

      The problem is that when no city is selected the validation fails, and stops the validation for the rest of the form. I would like on submit to have all fields validated in one phase.

      Is there any other way to solve the logic without using mmediate to true?

      Thanks a lot!