This content has been marked as final.
Show 4 replies
-
1. Re: concept question - suggestionBox - return value after se
nbelaevski Feb 26, 2009 1:19 PM (in response to alan79)Hello,
There is "fetchValue" attribute defining expression to evaluate in order to get input value. -
2. Re: concept question - suggestionBox - return value after se
alan79 Feb 27, 2009 6:29 AM (in response to alan79)"nbelaevski" wrote:
There is "fetchValue" attribute defining expression to evaluate in order to get input value.
Hi Nick
Maybe I described the scenario a bit too complicated. I try it again.
Actually I already use the "fetchValue" Attribute.
With the fetchValue attribute I am able to pass back a value to the inputText component. In this case this will be the contact full name (first/last).
At the moment when the user selects from the suggestionbox I have access to the whole project-object. Beside of the contact full name I would like to assign the contact-Id to a backing bean property.
How can I achieve this?
Here is my code (works fine so far for the contact full name):<h:outputLabel value="#{cont.lblProjectResponsible }" /> <h:panelGrid columns="2"> <h:panelGrid columns="2" border="0" cellpadding="0" cellspacing="0"> <h:inputText style="margin:0px;" value="#{projectHandler.projectCreateResponsible}" disabled="false" id="responsibleInput"/> <h:graphicImage value="#{facesContext.externalContext.requestContextPath}/../images/arrow.png" onclick="#{rich:component('suggestionResponsible')}.callSuggestion(true)" alt="" /> </h:panelGrid> <h:outputText id="responsiblesSuggested" style="font-weight:bold" /> </h:panelGrid> <rich:suggestionbox height="200" width="200" usingSuggestObjects="false" nothingLabel="No contacts found" onobjectchange="printObjectsSelected(#{rich:element('responsiblesSuggested')},#{rich:component('suggestionResponsible')});" suggestionAction="#{projectHandler.responsibleAutocomplete}" var="resp" for="responsibleInput" fetchValue="#{resp.firstName} #{resp.lastName}" id="suggestionResponsible" tokens=","> <h:column> <h:graphicImage value="../.././images/icon_person.jpg" /> </h:column> <h:column> <h:outputText value="#{resp.firstName} #{resp.lastName}" /> </h:column> <h:column> <h:outputText value="#{resp.contactId}" /> </h:column> </rich:suggestionbox>
Thank you very much for your help!
Regards
Alan -
3. Re: concept question - suggestionBox - return value after se
alan79 Feb 27, 2009 6:32 AM (in response to alan79)"alan79" wrote:
... I have access to the whole project-object...
Sorry. I messed up with project / contact example. I meant here the contact-object NOT project-object.
It is actually the same use case... it's always about record.Id and record.name... -
4. Re: Solution found! - concept question - suggestionBox - ret
alan79 Feb 27, 2009 7:00 AM (in response to alan79)Found myself the solution:
<rich:suggestionbox height="200" width="200" usingSuggestObjects="false" nothingLabel="No contacts found" onobjectchange="printObjectsSelected(#{rich:element('responsiblesSuggested')},#{rich:component('suggestionResponsible')});" suggestionAction="#{projectHandler.responsibleAutocomplete}" var="resp" for="responsibleInput" fetchValue="#{resp.firstName} #{resp.lastName} (#{resp.contactId})" id="suggestionResponsible" tokens=","> <h:column> <h:graphicImage value="../.././images/icon_person.jpg" /> </h:column> <h:column> <h:outputText value="#{resp.firstName} #{resp.lastName}" /> </h:column> <h:column> <h:outputText value="#{resp.contactId}" /> </h:column> <a4j:support event="onselect" action="#{projectHandler.responsibleSelect}"> <f:setPropertyActionListener value="#{resp.contactId}" target="#{projectHandler.projectCreateResponsibleId}" /> </a4j:support> </rich:suggestionbox>