0 Replies Latest reply on Aug 28, 2008 8:04 PM by gopib

    seam bugreport

    gopib
      I created suggestion box for country(nationality) using rich faces, and seam the problem am facing is "Only the topmost name in the list of the countries is displaying if also I select the country in the list of countries (like If I type "A", countries name starting with 'A' are displaying, at this time only the top most country is selected, If I select any of them).
      --------
      Action class
      ---------------

      public List autoComplete(Object suggest){
               String pref = (String)suggest;
                   ArrayList result = new ArrayList();
                   Iterator iterator = getAllData().iterator();
                   while(iterator.hasNext()){
                       NationalityList nationality = (NationalityList)iterator.next();
                       if((nationality!=null && nationality.getCountry().toLowerCase().indexOf(pref.toLowerCase())==0)||"".equals(pref)){    
                           result.add(nationality);
                       }                
                   }           
                   return result;
              }
            
              public ArrayList getAllData(){
                  ArrayList<NationalityList> tempList2 = new ArrayList<NationalityList>();
                  tempList2 = (ArrayList<NationalityList>) getEntityManager().createQuery("from NationalityList order by id").getResultList();
                  if(tempList2!=null)
                  {
                      for(NationalityList nationality : tempList2)
                      {
                          nationalityList.add(nationality);
                      }
                  }
                
                  return nationalityList;
              }




      Xhtml
      -------


      <h:column>                  
                      <h:inputText id="nationality"   required="true" value="#{mortgageApplicantHome.instance.individualApplicant.personal_Nationality}"
                          styleClass="formFont, formColumnInputText" validator="#{applicationValidators.checkBlankSpaces}"
                          requiredMessage="Please Enter Nationality">
                          <f:validateLength minimum="1" maximum="40" />                  
                          </h:inputText>
                      <rich:suggestionbox id="nationalityID" for="nationality"
                                  suggestionAction="#{mortgageApplicantHome.autoNatList}" var="result"
                                  fetchValue="#{result.nationality}"
                                  minChars="0" nothingLabel="No Nationality found" columnClasses="center">
                     <h:column>
                        <h:outputText value="#{result.nationality}"/>
                     </h:column>