1 Reply Latest reply on Aug 26, 2010 7:56 AM by Ilya Shaikovsky

    Get selected object from suggestionbox

    Steven De Groote Newbie

      Hi,

       

      on my website I'm trying to create an input field where I can enter free text or select an existing driver.

      While this works so far, the problem is that when selecting an existing one, I only get the driver's name in the backing bean, so I really don't know if this is an existing one or a free text.

       

      Is there any way I can find out in the bean if a user selected an object from the suggestionbox or just entered a string?

       

      {code}

      <h:inputText id="drivername2" value="#{driverList.driverName}" size="25">
                                  <rich:suggestionbox height="250" width="600" rowClasses="row1,row2" for="drivername2" suggestionAction="#{quoteDriver.autocomplete}" var="driver">
                                      <h:column>
                                          <h:outputText value="#{driver.identification}" />
                                      </h:column>
                                      <h:column>
                                          <h:outputText value="#{driver.address}" />
                                      </h:column>
                                      <h:column>
                                          <h:outputText value="#{driver.city}"/>
                                      </h:column>
                                  </rich:suggestionbox>
                              </h:inputText>

      {code}

       

      Thanks,

      Steven