Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-11332

Improve AutoComplete component to support Object values separate from AutoCompleteinput field

    Details

    • Type: Feature Request
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.1.0.Milestone1
    • Fix Version/s: None
    • Component/s: component-input
    • Labels:
      None

      Description

      <rich:autocomplete id="client" value="#{newService.client}" autocompleteMethod="#{entitySearch.appEntityClients}" var="_a" fetchValue="#{_a}">
         <h:outputText value="#{_a.name}" />
      </rich:autocomplete>
      

      Given the above code the fetchValue which is placed in the generated inputText box is what is actually submitted with the form.

      To support POJO selects what is needed is to have a value and a valueLabel so that the fetchValue can be displayed to the user but the acutal converted object value is submitted to the form.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            bleathem Brian Leathem added a comment -

            I haven't yet looked at the implementation, but it seems to me that what is required is to have another "hidden" input that holds the submitted value. The visible inputText would hold a label for the value. We would then need a new attribute valueLabel, that would be of the form #

            {var.myLabel}

            .

            The value that goes into the hidden input should be the string returned from the converter, so it can be converted back to an object on form submission.

            Show
            bleathem Brian Leathem added a comment - I haven't yet looked at the implementation, but it seems to me that what is required is to have another "hidden" input that holds the submitted value. The visible inputText would hold a label for the value. We would then need a new attribute valueLabel, that would be of the form # {var.myLabel} . The value that goes into the hidden input should be the string returned from the converter, so it can be converted back to an object on form submission.
            Hide
            clerum Cody Lerum added a comment - - edited

            Primefaces 2.2 does it like this

            <p:autoComplete value="#

            {autoCompleteBean.selectedPlayer}

            " completeMethod="#

            {autoCompleteBean.completePlayer}

            " var="player" itemLabel="#

            {player.name}

            " itemValue="#

            {player}

            " converter="player"/>

            However there appears to be issues trying to observe on change events.

            Show
            clerum Cody Lerum added a comment - - edited Primefaces 2.2 does it like this <p:autoComplete value="# {autoCompleteBean.selectedPlayer} " completeMethod="# {autoCompleteBean.completePlayer} " var="player" itemLabel="# {player.name} " itemValue="# {player} " converter="player"/> However there appears to be issues trying to observe on change events.
            Hide
            clerum Cody Lerum added a comment -

            Also I need to be able to observe an on change event with f:ajax so that I can have the value pushed to the backing bean via ajax and rerender parts of the page.

            Show
            clerum Cody Lerum added a comment - Also I need to be able to observe an on change event with f:ajax so that I can have the value pushed to the backing bean via ajax and rerender parts of the page.
            Hide
            ilya_shaikovsky Ilya Shaikovsky added a comment -
            Show
            ilya_shaikovsky Ilya Shaikovsky added a comment - http://community.jboss.org/message/621988#621988 - added some comments.
            Hide
            clerum Cody Lerum added a comment -

            Something like this - http://xoxco.com/clickable/jquery-tags-input but with support for only a single Object value as well as multiple Object values.

            Show
            clerum Cody Lerum added a comment - Something like this - http://xoxco.com/clickable/jquery-tags-input but with support for only a single Object value as well as multiple Object values.
            Hide
            bleathem Brian Leathem added a comment -

            New issue created to track adding autocomplete functionality to the rich:select component RF-11453

            Show
            bleathem Brian Leathem added a comment - New issue created to track adding autocomplete functionality to the rich:select component RF-11453
            Hide
            bleathem Brian Leathem added a comment -

            From a pragmatic perspective, adding an extra hidden input to the autocomplete for use with the converter is likely the simplest solution for the given use case. As such I'm re-opening this issue. If after an initial PoC it does not prove to be a simpler approach than the select-based RF-11453 we can re-close the issue.

            Show
            bleathem Brian Leathem added a comment - From a pragmatic perspective, adding an extra hidden input to the autocomplete for use with the converter is likely the simplest solution for the given use case. As such I'm re-opening this issue. If after an initial PoC it does not prove to be a simpler approach than the select-based RF-11453 we can re-close the issue.
            Hide
            bleathem Brian Leathem added a comment -

            On further investigation, it seems that adding autocomplete functionality to the select component is simpler.

            Show
            bleathem Brian Leathem added a comment - On further investigation, it seems that adding autocomplete functionality to the select component is simpler.

              People

              • Assignee:
                Unassigned
                Reporter:
                clerum Cody Lerum
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                    Development

                      Agile