0 Replies Latest reply on Mar 3, 2008 9:51 AM by diego.peroni

    [suggestionBox] problem trying to catch selected option on b

    diego.peroni

      Hi,

      I'm using suggestionBox, everything works well but the thing is that I cannot catch the selected value on the back bean.

      I have to suggest countries according to the ones that exist on my database. The suggestions appear correctly, but I the problem is this: for example, if I type 's', 'Spain' appears as a suggestion, I choose it but the back bean's attribute value is 's'.

      Only when I submit the form the back bean gets the "whole value" (Spain). But I need it immediately, since I have to filter options for another suggestionBox (for State/Province) according to the country I choose.

      I've tried a million things, but i cannot find the solution.

      I leave the code below, thanks in advance!

      <h:outputText value="#{Message.country}#{Message.twoPoints}" />
      <h:outputText value=" " escape="false" />
      <a4j:region id="regSuggCountry">
      <h:inputText id="country" value="#{customer.country}"
      maxlength="40" styleClass="txt_componentes" size="40"
      onmouseout="hidefloatie();"
      onmouseover="showfloatie(fieldRequired+fieldMaxLength+'40'+fieldCharacter,event);"
      onkeydown="if(event.keyCode==13) event.keyCode=9;"/>
      <rich:suggestionbox id="countrySuggestions" for="country"
      height="100" width="250" minChars="1"
      var="resultCountry"
      suggestionAction="#{customer.countriesSuggestionList}"
      nothingLabel="#{Message.noSuggestions}">
      <h:column>
      <h:outputText id="suggCountryCol" value="#{resultCountry.description}"/>
      </h:column>
      </rich:suggestionbox>
      </a4j:region>
      <h:message for="country" styleClass="errorMessage" />


      'description' is the name of the country (a String, naturally).