0 Replies Latest reply on Jul 7, 2007 6:35 AM by Thiagu Mariappan

    suggestionbox not working proper no the modal panel

    Thiagu Mariappan Novice

      i have a problem when i using suggestionbox on the modal panel
      i am using rich faces 3.0.1
      i am using backing bean with suggestionbox for auto complete my country text field
      it is working proper with out modal panel and ajax support component
      when i using ajax support component , each ajax call will clearer the my country text field , how can i resolve my problem
      and i have one more problem is
      please any one help me
      i give my sample code here

      <a href="javascript:Richfaces.showModalPanel('reg',{width:450, top:200})">click here</a>
      <rich:modalPanel id="reg" height="270" width="500" zindex="2000">
      <h:form id="suggestionbox_form">
      <s:decorate id="countryDecorate" emplate="layout/edit.xhtml">
       <ui:define name="label">Country:</ui:define>
       <h:inputText value="#{user.country}" id="country" required="true" >
       <a:support event="onblur" reRender="countryDecorate"/>
       </h:inputText>
       <rich:suggestionbox id="suggestionBoxId" for="country" tokens=",[" rules="#{suggestionBox.rules}"
       suggestionAction="#{suggestionBox.autocomplete}" var="result"
       fetchValue="#{result.text}"
       rows="#{suggestionBox.intRows}"
       first="#{suggestionBox.intFirst}"
       minChars="#{suggestionBox.minchars}"
       shadowOpacity="#{suggestionBox.shadowOpacity}"
       border="#{suggestionBox.border}"
       width="#{suggestionBox.width}"
       height="#{suggestionBox.height}"
       shadowDepth="#{suggestionBox.shadowDepth}"
       cellpadding="#{suggestionBox.cellpadding}">
       <h:column>
       <h:outputText value="#{result.text}" />
       </h:column>
       </rich:suggestionbox>
      
      
      </s:decorate>
      
      </h:form>
       </rich:modalPanel>
      ===========================================
      this is my SuggestionBox class autocomplete method
      public List autocomplete(Object suggest)
       {
       String pref = (String)suggest;
       ArrayList result = new ArrayList();
       Iterator iterator = getAllData().iterator();
       do
       {
       if(!iterator.hasNext())
       {
       break;
       }
       Data elem = (Data)iterator.next();
       if(elem != null && elem.getText().toLowerCase().indexOf(pref.toLowerCase()) == 0 || "".equals(pref))
       {
       result.add(elem);
       }
       } while(true);
       return result;
       }