2 Replies Latest reply on Dec 22, 2009 3:53 AM by Ilya Shaikovsky

    rich:suggestionbox selected value not kept in inputText

    marian furdui Newbie
      Hi!

      I have issues with rich:suggestionbox inside an s:decorate that is also placed in a rich:tree.
      To make the suggestionbox to be displayed I had to add an <a:region renderRegionOnly="true"> as shown below.

      <rich:tree id="tree" eventsQueue="queue" value="#{valuation.root}"
          var="item" treeNodeVar="node" switchType="client"
          ajaxSubmitSelection="false" stateVar="stVar"
          adviseNodeOpened="#{treeStateController.adviseTreeNodeOpened}"
          adviseNodeSelected="#{treeStateController.adviseTreeNodeSelected}"
          changeExpandListener="#{treeStateController.changeExpandListener}"
          nodeSelectListener="#{treeStateController.nodeSelectListener}"
          toggleOnClick="false" rowKeyVar="rk">
          <rich:treeNode id="treeNode">
              <s:div>
                  <table>
                      <tr>
                          <td style="width: 250px; height: 25px; vertical-alignment: middle">
                          <s:decorate id="valueField2" template="includes/edit.xhtml">
                              <a:region renderRegionOnly="true">
                                  <h:inputText id="valueInput2" value="#{node.data.value}"
                                      style="width: 200px;" required="#{node.data.required}"
                                      validator="valuationModelValidator">
                                      <a:support event="onclick" focus="valueInput2" ajaxSingle="true"
                                          action="#{valueList.setPropertyPointer(node.data.propertyPointer)}" />
                                      <a:support event="onblur" reRender="valueField2"
                                          ajaxSingle="true" bypassUpdates="true" />
                                      <f:attribute name="nodeData" value="#{node.data}" />
                                  </h:inputText>
                                  <rich:suggestionbox id="suggestion" for="valueInput2"
                                      minChars="1" frequency="0" ajaxSingle="true" height="150"
                                      ignoreDupResponses="true" requestDelay="200" var="result"
                                      nothingLabel="#{messages.noProposalFound}"
                                      suggestionAction="#{valueList.suggest}">
                                      <f:facet name="header">
                                          <h:outputText value="#{messages.proposals}" />
                                      </f:facet>
                                      <h:column>
                                          <h:outputText value="#{result}" />
                                      </h:column>
                                  </rich:suggestionbox>
                              </a:region>
                          </s:decorate>
                          </td>
                      </tr>
                  </table>
              </s:div>
              <a:support event="onexpand" ajaxSingle="true"
                  action="#{treeStateController.aSupportChangeExpandListener(node.data.id, stVar.isExpanded(rk)? 'true' : 'false' )}" />
              <a:support event="oncollapse" ajaxSingle="true"
                  action="#{treeStateController.aSupportChangeExpandListener(node.data.id, stVar.isExpanded(rk))}" />
          </rich:treeNode>
      </rich:tree>

      Now rich:suggestionbox works ok, but the validation error is not shown as the s:decorate is placed outside the a:region so it is not rendered.
      If I move the <a:region renderRegionOnly="true"> outside the s:decorate, the selected value from the rich:suggestionbox is not keept in the inputText.

      How to keep the selected value from the rich:suggestionbox in the inputText?

      seam version=2.2.0.GA
      richfaces version=3.3.2.SR1