6 Replies Latest reply: Nov 25, 2011 7:19 AM by Leandro godoy RSS

    RichCombobox Sugestion customization

    Leandro godoy Newbie

      I can not adiconar methods using Richfaces.ComboBoxList.addMethods (
        * Need to change the way the search sugestion, I am importing the
        * Scripts with <a4j: loadScript template.xml put in in my firebug got the following error:
        * Richfaces.ComboBoxList is undefined
      combolist.js () combolist.js (line 116)
      [Stop this error] Richfaces.ComboBoxList.addMethods ({


      Can anyone help?

       

      Thanks.

        • 1. Re: RichCombobox Sugestion customization
          Leandro godoy Newbie

          I try use this example

          http://community.jboss.org/wiki/EnhancedRichcomboBoxValuesnotOnlyTextAndRegExpSuggestions

           

          this erro in firebug console :

           

          Richfaces.ComboBoxList is undefined
          combolist.js () combolist.js (line 116)
          [Stop this error] Richfaces.ComboBoxList.addMethods ({

           

          Oh my god, please reply me ilya.

          thanks.

          • 2. Re: RichCombobox Sugestion customization
            Leandro godoy Newbie

            Not yet solved this problem

            • 3. Re: RichCombobox Sugestion customization
              Leandro godoy Newbie

              Could solve the first problem, now the combo is rendered without errors firebug, but
              loads data not see my code:

               

              <?xml version="1.0" encoding="ISO-8859-1" ?>

              <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                  xmlns:ui="http://java.sun.com/jsf/facelets"

                  xmlns:h="http://java.sun.com/jsf/html"

                  xmlns:f="http://java.sun.com/jsf/core"

                  xmlns:a4j="http://richfaces.org/a4j"

                  xmlns:rich="http://richfaces.org/rich"

                  xmlns:validator="http://sanepar.com.br/validator"

                  xmlns:c="http://java.sun.com/jstl/core">

               

               

              <script src="#{facesContext.externalContext.requestContextPath}/js/combolist.js" type="text/javascript" >

               

              </script>

               

              <script src="#{facesContext.externalContext.requestContextPath}/js/utils.js" type="text/javascript" >

               

              </script>

               

              <script type="text/javascript">

              //<![CDATA[

              function myValueClearFn() {

                  $jq('#myValue').val(null);

              }

              function myValueUpdaterFn() {

                $jq('#myValue').val(#{rich:component('formToogle:myComboBox')}.comboList.selectedItemValue);

              }

              //]]>

              </script>

               

               

              <script type="text/javascript">

              //<![CDATA[   

                  #{rich:component('formToogle:myComboBox')}.comboList.itemsValue = #{mBProdutoQuimico.produtosDesc};

                  #{rich:component('formToogle:myComboBox')}.comboList.itemsText  = #{mBProdutoQuimico.produtosDesc};

              //]]>

              </script>

               

              <h:inputHidden id="myValue" />

                  <a4j:keepAlive beanName="mBProdutoQuimico" />

                  <a4j:outputPanel ajaxRendered="true">

                      <div class="contorno_azul">

                      <div id="formVert" style="width: 305px;">

                      <h5><h:outputText value="Passo 4 de 10:" rendered="#{paramUI}" />

                      <strong> <h:outputText value="Produtos Químicos" /></strong></h5>

                     

                      <ui:include src="/pages/fragments/refBlock.xhtml">

                          <ui:param name="disabledReferenciaInicial"

                              value="#{!mBProdutoQuimico.habilitaReferenciaInicial}" />

                          <ui:param name="disabledReferenciaFinal"

                              value="#{!mBProdutoQuimico.habilitaReferenciaFinal}" />

                          <ui:param name="renderedReferenciaFinal"

                              value="#{!mBProdutoQuimico.isNewRecord}" />

                          <ui:param name="mBean" value="#{mBProdutoQuimico}" />

                      </ui:include>

                     

                      <rich:comboBox id="myComboBox"

                    width="350" listWidth="400" listHeight="200"

                    selectFirstOnUpdate="true"

                    onlistcall="myValueClearFn()"

                    onselect="myValueUpdateFn()" />

                     

                     

                     

                     

                     

                      <p><label>Nome do produto:</label>

                      <h:inputText  label="Nome do Produto" disabled="#{!mBProdutoQuimico.habilitaNomeProduto}"

                          value="#{mBProdutoQuimico.produto.nome}" style="width:265px;"

                          required="true" >           

                              <validator:validateTrim errorDetail="Não é permitido somente espaços em branco!"/>

                          </h:inputText>

                          </p>

                      <p><label>Forma de dosagem:</label> <h:selectOneMenu

                          label="Forma de Dosagem"

                          value="#{mBProdutoQuimico.produto.formaDosagem}" style="width:125px;"

                          required="true" disabled="#{!mBProdutoQuimico.habilitaFormaDosagem}">

                          <f:selectItems value="#{mBProdutoQuimico.formasDosagem}" />

                      </h:selectOneMenu></p>

                      </div>

               

                      </div>

                  </a4j:outputPanel>

              </ui:composition>

               

              please help me, thanks

               

              • 4. Re: RichCombobox Sugestion customization
                Christian Peter Expert

                What ever "adiconar" means.....

                 

                Is this ui:composition inside a form?

                 

                The id of '<h:inputHidden id="myValue" />' should be something like 'formId:myValue' and accessing it with jQuery('#myValue') would not work. You have to use the full path and have to escape the clientId: jQuery('#formId\:myValue')  .... or \\: I'm not sure right now.

                 

                You should look into the richfaces example pages or the for free edition of 'practical richfaces' for valuebinding etc.

                • 5. Re: RichCombobox Sugestion customization
                  Leandro godoy Newbie

                  <script type="text/javascript">

                  //<![CDATA[

                  function myValueClearFn() {   

                      $jq('#formId\:myValue').val(null);

                  }

                  function myValueUpdaterFn() {

                      alert('myValueUpdaterFn');

                    $jq('#formId\:myValue').val(#{rich:component('formToogle:myComboBox')}.comboList.selectedItemValue);

                  }

                  //]]>

                  </script>

                   

                   

                  <script type="text/javascript">

                  //<![CDATA[            

                     #{rich:component('formToogle:myComboBox')}.comboList.itemsText  = ['Java Programming Language', 'PHP Hypertext Preprocessor', 'Active Server Pages'];

                     #{rich:component('formToogle:myComboBox')}.comboList.itemsValue = ['java', 'php', 'asp'];

                     #{rich:component('formToogle:myComboBox')}.comboList.itemsValueExclude = ['asp'];

                  //]]>

                  </script>

                   

                  <h:inputHidden id="myValue" />

                  <rich:comboBox id="myComboBox"
                    width="350" listWidth="400" listHeight="200"
                    selectFirstOnUpdate="true"
                    onlistcall="myValueClearFn()"
                    onselect="myValueUpdateFn()" />
                  • 6. Re: RichCombobox Sugestion customization
                    Leandro godoy Newbie

                    Thanks a lot Christian ,could solve the problem, your tips were very important to solve the problem.
                    my page looks like this:

                     

                    <?xml version="1.0" encoding="ISO-8859-1" ?>

                    <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                        xmlns:ui="http://java.sun.com/jsf/facelets"

                        xmlns:h="http://java.sun.com/jsf/html"

                        xmlns:f="http://java.sun.com/jsf/core"

                        xmlns:a4j="http://richfaces.org/a4j"

                        xmlns:rich="http://richfaces.org/rich"

                        xmlns:validator="http://sanepar.com.br/validator"

                        xmlns:c="http://java.sun.com/jstl/core">

                        <script

                            src="#{facesContext.externalContext.requestContextPath}/js/combolist.js"

                            type="text/javascript">

                    </script>

                        <script

                            src="#{facesContext.externalContext.requestContextPath}/js/utils.js"

                            type="text/javascript">

                     

                    </script>   

                        <a4j:keepAlive beanName="mBProdutoQuimico" />

                        <a4j:outputPanel ajaxRendered="true">

                            <div class="contorno_azul">

                            <div id="formVert" style="width: 305px;">

                            <h5><h:outputText value="Passo 4 de 10:" rendered="#{paramUI}" />

                            <strong> <h:outputText value="Produtos Químicos" /></strong></h5>

                           

                            <p><label>Produtos químicos:</label>

                            <rich:comboBox id="myComboBox" width="270" listWidth="400"

                            defaultLabel="Selecione um produto."

                                required="true" disabled="#{!mBProdutoQuimico.habilitaComboProduto}"

                                value="#{mBProdutoQuimico.selectedProduto}" listHeight="400"

                                selectFirstOnUpdate="true" >

                                <f:selectItems value="#{mBProdutoQuimico.produtos}" />

                                <f:converter converterId="produtoQuimicoConverter" />

                            </rich:comboBox></p>

                            </div>

                            </div>

                        </a4j:outputPanel>

                    </ui:composition>

                     

                     

                     

                    Chael Sonnen will be destroyed by Anderson Silva