1 Reply Latest reply on Apr 3, 2008 4:36 AM by ilya_shaikovsky

    Need help populating a select

    enikozsido

      Hello,

      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" />
       </h:selectOneMenu>
      
      <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" />
      </h:selectOneMenu>
      </a:outputPanel>
      


      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!

      Eniko