rich:suggestionbox - Passing values to other suggestion boxes
mikjall77 Mar 24, 2011 3:42 PMLooking for help to get pointed in the right direction. I'm currently working on a project where we have three suggestion boxes that are tied to each other within our database. Individually, the rich:suggestion boxes work perfectly (showing 3 columns with the fetchValue based on what inputText box you're searching). What I am unsure of doing (mainly because I'm not good at coding JavaScript) is how to pass the selected values to the other input fields? I'm assuming it is through JavaScript and not through the rich:suggestionbox attributes.
Here's my xhtml code for the suggestion boxes:
[code]
<s:decorate template="/layout/verticaldisplay.xhtml">
<ui:param
name="label"
value="Customer Name" />
<ui:param
name="underLabel"
value="(minimum 2 characters)"/>
<h:inputText
id="customerName"
value="#{gnvcustomerdataList.gnvcustomerdata.customerName}" />
<rich:suggestionbox
id="customerNameSBox"
for="customerName"
var="result"
fetchValue="#{result.customerName}"
suggestionAction="#{customerSearchBean.autocomplete}"
minChars="2"
nothingLabel="No customers found"
width="400"
height="250">
<h:column>
<h:outputText value="#{result.customerName}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerAddress}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerCity}" />
</h:column>
</rich:suggestionbox>
</s:decorate>
<s:decorate template="/layout/verticaldisplay.xhtml">
<ui:param
name="label"
value="Address" />
<ui:param
name="underLabel"
value="(minimum 2 chars)"/>
<h:inputText
id="customerAddress"
value="#{gnvcustomerdataList.gnvcustomerdata.id.customerAddress}" />
<rich:suggestionbox
id="customerAddressSBox"
for="customerAddress"
var="result"
fetchValue="#{result.customerAddress}"
suggestionAction="#{customerSearchBean.autocompleteCustAddr}"
minChars="2"
nothingLabel="No customers found"
bypassUpdates="true"
width="400"
height="250"
ignoreDupResponses="true">
<h:column>
<h:outputText value="#{result.customerAddress}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerName}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerCity}" />
</h:column>
</rich:suggestionbox>
</s:decorate>
<s:decorate template="/layout/verticaldisplay.xhtml">
<ui:param
name="label"
value="City" />
<ui:param
name="underLabel"
value="(Minimum three chars)"/>
<h:inputText
id="customerCity"
value="#{gnvcustomerdataList.gnvcustomerdata.id.customerCity}" />
<rich:suggestionbox
id="customerCitySBox"
for="customerCity"
var="result"
fetchValue="#{result.customerCity}"
suggestionAction="#{customerSearchBean.autocompleteCustCity}"
minChars="3"
nothingLabel="No customers found"
bypassUpdates="true"
width="400"
height="280"
ignoreDupResponses="true">
<h:column>
<h:outputText value="#{result.customerCity}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerName}" />
</h:column>
<h:column>
<h:outputText value="#{result.customerAddress}" />
</h:column>
</rich:suggestionbox>
</s:decorate>
[/code]