fetchValue in suggestionbox returns wrong value
benjes Sep 2, 2008 12:16 PMHi
I am having a problem with the suggestionbox and fetchValue.
fetchValue will always use the first item returned in the suggestion list and not the item which was actually selected. If I don't use fetchValue the right item is used (but also all the other stuff in the table column which I don't want).
Any idea what why this might happen? Could it be the combination with s:decorate?
<a4j:region id="suggestRegion"> <s:decorate id="suggestDecorate" template="/layout/edit.xhtml"> <ui:define name="label"> <h:outputText value="#{messages.SearchName}:" /> </ui:define> <h:inputText id="name" value="#{newEntity.name}" required="true" tabindex="0" size="40"/> <rich:suggestionbox id="suggestionBoxId" for="name" tokens=",[" rules="none" suggestionAction="#{manager.autocomplete}" var="result" fetchValue="#{result.name}" minChars="2" border="1" width="400" height="200" cellpadding="4" eventsQueue="foo" ignoreDupResponses="true" immediate="true" columnClasses="center"> <h:column> <h:outputText value="#{result.name}" /> </h:column> <h:column> <h:outputText value="#{result.town}" rendered="#{!result.town}" style="font-style:italic"/> </h:column> <h:column> <h:outputText value="#{result.state}" rendered="#{!result.state}"/> </h:column> <h:column> <h:outputText value="#{result.country}" rendered="#{!result.country}" style="font-style:italic"/> </h:column> <a4j:support event="onselect" reRender="MyID" immediate="true"> <f:setPropertyActionListener value="#{result}" target="#{manager.currentEntity}" /> </a4j:support> </rich:suggestionbox> <ui:define name="info"> <a4j:status> <f:facet name="start"> <h:graphicImage value="/img/ajax-loader.gif"/> </f:facet> </a4j:status> </ui:define> </s:decorate> </a4j:region>
The template used 'edit.xhtml'
<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:s="http://jboss.com/products/seam/taglib"> <div class="prop"> <s:label styleClass="name #{invalid?'errors':''}"> <ui:insert name="label"/> <s:span styleClass="required" rendered="#{required}">*</s:span> </s:label> <span class="value #{invalid?'errors':''}"> <s:validateAll> <ui:insert/> </s:validateAll> </span> <s:span styleClass="info" rendered="#{not invalid}"><ui:insert name="info"/></s:span> <span class="error"> <h:graphicImage value="/img/error.gif" rendered="#{invalid}" styleClass="errors"/> <s:message styleClass="errors"/> </span> </div> </ui:composition>