4 Replies Latest reply on Nov 4, 2009 2:42 AM by simonc2009

    Do not work if there are suggestion box, converter and reRen

    simonc2009

      Hi all,

      Currently, I have a datatable, with a field, allow user manual input or "select row" from a suggestion box. I prefer the manual input value can be "converted" to upper case and displayed immediate on that field once user lose focus of that field.

      Above look easy, but I found problem using below code.

      ===================
      <rich:column id="column4">
      <h:panelGroup>
      <h:inputText id="unitCode" value="#{hot.unitCode}"
      disabled="#{not userRights}" >
      <f:converter converterId="itemBeanToUpperCaseConverter"/>
      <a:support event="onchange"
      <--- add reRender="unitCode" make drop down
      suggestion fail and javascript error -->
      actionListener="#{hot.statusListener}"/>
      </h:inputText>

      <h:graphicImage value="../../img/arrow.png"
      onclick="#{rich:component('suggestion')}.callSuggestion(true)"/>
      </h:panelGroup>
      <rich:suggestionbox id="suggestion" for="unitCode" fetchValue="#
      {unit.deptUnitCode}" height="200" width="300"
      suggestionAction="#{sysDeptUnitList.autoComplete}" var="unit"
      selfRendered="true">
      <h:column> ... </h:column>
      <a:support event="onselect"
      actionListener="#{hot.statusListener}"/>
      </rich:suggestionbox>
      </rich:column>

      ===================

      If I add the "reRender" attribute, there is javascript error and make the drop down suggestion box fail.

      If I remove the "reRender" attribute, the upper case value do not show once user lose focus of that field.

      Can someone kindly help me, thanks.

        • 1. Re: Do not work if there are suggestion box, converter and r
          nbelaevski

          Hi,

          You should re-render suggestionBox also.

          • 2. Re: Do not work if there are suggestion box, converter and r
            simonc2009

            Hi,

            Thank your reply.
            However, having add render "unitcode" and "suggestionbox"

            I still got the problem of javascript error; when I lost focus of the text field.

            I got the code below and please tell me how to fix the
            javascript error. Thanks

            ===================
            <rich:column id="column4">
            <h:panelGroup>
            <h:inputText id="unitCode" value="#{hot.unitCode}"
            disabled="#{not userRights}" >
            <f:converter converterId="itemBeanToUpperCaseConverter"/>
            <a:support event="onchange"
            reRender="unitCode" <----- try got javascript error or
            reRender="unitCode, suggestion" <----- another try still got
            javascript error
            actionListener="#{hot.statusListener}"/>
            </h:inputText>

            <h:graphicImage value="../../img/arrow.png"
            onclick="#{rich:component('suggestion')}.callSuggestion(true)"/>
            </h:panelGroup>
            <rich:suggestionbox id="suggestion" for="unitCode" fetchValue="#
            {unit.deptUnitCode}" height="200" width="300"
            suggestionAction="#{sysDeptUnitList.autoComplete}" var="unit"
            selfRendered="true">
            <h:column> ... </h:column>
            <a:support event="onselect"
            reRender="unitCode" <----- try got javascript error or
            reRender="unitCode, suggestion" <----- another try still got
            javascipt error
            actionListener="#{hot.statusListener}"/>
            </rich:suggestionbox>
            </rich:column>

            ===================

            If I add the "reRender" attribute, there is javascript error and make the drop down suggestion box fail.

            If I remove the "reRender" attribute, the upper case value do not show once user lose focus of that field.

            Can someone kindly help me, thanks.

            • 3. Re: Do not work if there are suggestion box, converter and r
              ilya_shaikovsky

              which JS error? try to use
              a4j:outputPanel with layout=block instead of panelGroup and reRender the whole outputPanel.

              • 4. Re: Do not work if there are suggestion box, converter and r
                simonc2009

                Hi.

                Thanks for the previous reply.

                However, I follow the way of using <a:outputPanel>, but still got javascript error, which prevent the popup of the selection box comes from suggestion box.

                All I want is, function allow user to select item from suggestion box, or user manual input value in the input box. If user input value, the converter will change input value to upper case and re-show on the input text box.

                So, can you further suggest way to solve my problem

                Sample Code
                ---------------
                <a:outputPanel id="dacBlock" layout="block" >
                <h:panelGrid width="80px" columns="2">
                <h:inputText id="currCode" value="#{glJrnlVchrMast.currCode}" >
                <f:converter converterId="itemBeanToUpperCaseConverter"/>
                <a:support event="onchange" reRender="dacBlock"/>
                </h:inputText>

                <h:graphicImage value="../../img/arrow.png"
                onclick="#{rich:component('suggestion4')}.callSuggestion(true)"
                alt=""/>

                <rich:suggestionbox id="suggestion4" for="currCode" fetchValue="#
                {currCodeDn.pk.currCode}" height="200" width="300"
                suggestionAction="#{glCurrCodeDnList.autoComplete}"
                var="currCodeDn" selfRendered="true">
                <h:column>
                <h:outputText value="#{currCodeDn.pk.currCode}" />
                </h:column>
                <h:column>
                <h:outputText value="#{currCodeDn.currDesc}" />
                </h:column>
                <a:support event="onselect"
                reRender="dacBlock"/>
                </rich:suggestionbox>
                </h:panelGrid>

                </a:outputPanel>