ICEfaces
  1. ICEfaces
  2. ICE-10216

ace:autoCompleteEntry selectItems using label instead of value

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.BETA
    • Fix Version/s: 4.1
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Tomcat 7

      Description

      I created an array of SelectItem objects and bound it to the ace:autoCompleteEntry component like this:

                  <ace:autoCompleteEntry value="#{navigationModel.searchValue}"
                                         valueChangeListener="#{navigationController.navigate}"
                                         placeholder="Search"
                                         filterMatchMode="contains"
                                         width="180">
                      <f:selectItems value="#{navigationModel.currentComponentGroup.searchSelectItems}"/>
                  </ace:autoCompleteEntry>

      The event in the ValueChangeListener is returning the selected label as the new value, instead of the value used in creating the SelectItem object.

      The showcase uses a SelectItem constructor with a single parameter, the label that is used for label and value. We need it to work with the SelectItem constructors that also pass in a separate value.

        Activity

        Hide
        Brad Kroeger added a comment -

        I have committed the searchform to the showcase. It's at the top of the menu in showcase.xhtml.

        Put a break point in navigationController.navigate and you should see the valuechangelistener event using the label instead of the value (in the navigate method, replace navigate(null,event.getNewValue().toString()); with navigate(null,null) first because the labels all have a ':' in them which is throwing an exception)

        Show
        Brad Kroeger added a comment - I have committed the searchform to the showcase. It's at the top of the menu in showcase.xhtml. Put a break point in navigationController.navigate and you should see the valuechangelistener event using the label instead of the value (in the navigate method, replace navigate(null,event.getNewValue().toString()); with navigate(null,null) first because the labels all have a ':' in them which is throwing an exception)
        Hide
        Arturo Zambrano added a comment -

        r45805: modified ace:autoCompleteEntry to use the SelectItem's value as the actual value of the options in the popup list and the label as the text that actually gets displayed in the list.

        Testing Notes: Please test both server side and client side modes, in combination with using an inField label and not using it, since I ran into some issues when using inField labels, which I think are fixed now. Also, run all the regression tests and make sure nothing was affected.

        Note that when using separate labels and values, after selecting an option, the actual value (and not the label) will be displayed in the text field.

                <ace:autoCompleteEntry id="autoComplete"
                                       value="#{autoCompleteEntryBean.selectedText}"
                                       rows="10" width="300">
                    <f:selectItem itemLabel="label1" itemValue="value1" />
                    <f:selectItem itemLabel="label2" itemValue="value2" />
                    <f:selectItem itemLabel="label3" itemValue="value3" />
                </ace:autoCompleteEntry>
        

        In the example above, the list will display 'label1', 'label2' and 'label3'. After selecting one of those options, the text field will be populated with 'value1', 'value2', or 'value3', accordingly.

        Show
        Arturo Zambrano added a comment - r45805: modified ace:autoCompleteEntry to use the SelectItem's value as the actual value of the options in the popup list and the label as the text that actually gets displayed in the list. Testing Notes: Please test both server side and client side modes, in combination with using an inField label and not using it, since I ran into some issues when using inField labels, which I think are fixed now. Also, run all the regression tests and make sure nothing was affected. Note that when using separate labels and values, after selecting an option, the actual value (and not the label) will be displayed in the text field. <ace:autoCompleteEntry id= "autoComplete" value= "#{autoCompleteEntryBean.selectedText}" rows= "10" width= "300" > <f:selectItem itemLabel= "label1" itemValue= "value1" /> <f:selectItem itemLabel= "label2" itemValue= "value2" /> <f:selectItem itemLabel= "label3" itemValue= "value3" /> </ace:autoCompleteEntry> In the example above, the list will display 'label1', 'label2' and 'label3'. After selecting one of those options, the text field will be populated with 'value1', 'value2', or 'value3', accordingly.
        Hide
        Carmen Cristurean added a comment -

        ICEfaces4 trunk r45807; verified showcase > ace:autoCompleteEntry, tested manually QA autoCompleteEntry tests (FF34, Chrome43, IE11).

        A new test page was added to QA ace:autoCompleteEntry test application:
        http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/autoCompleteEntry
        Test page: /ICE-10216.jsf

        If the autoCompleteEntry has no option selected, and the clientSide is enabled, changing the label position displays multiple times the autoCompleteEntry label text ("LABEL").
        Steps:

        • go to /ICE-10216.jsf, do not select any option in the autoCompleteEntry.
        • enable clientSide.
        • change labelPosition from 'inField' to any other option > the label value is rendered as in attached image.
        Show
        Carmen Cristurean added a comment - ICEfaces4 trunk r45807; verified showcase > ace:autoCompleteEntry, tested manually QA autoCompleteEntry tests (FF34, Chrome43, IE11). A new test page was added to QA ace:autoCompleteEntry test application: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/autoCompleteEntry Test page: / ICE-10216 .jsf If the autoCompleteEntry has no option selected, and the clientSide is enabled, changing the label position displays multiple times the autoCompleteEntry label text ("LABEL"). Steps: go to / ICE-10216 .jsf, do not select any option in the autoCompleteEntry. enable clientSide. change labelPosition from 'inField' to any other option > the label value is rendered as in attached image.
        Hide
        Arturo Zambrano added a comment -

        r45816: committed fix to remove 'name' attribute when the inField label is on, in order to avoid submitting the label as the value when submitting the form from outside the component.

        This was actually an existing issue. It was fixed with the same technique used in ace:textEntry to avoid submitting the inField label. Please report if there are any regressions.

        Show
        Arturo Zambrano added a comment - r45816: committed fix to remove 'name' attribute when the inField label is on, in order to avoid submitting the label as the value when submitting the form from outside the component. This was actually an existing issue. It was fixed with the same technique used in ace:textEntry to avoid submitting the inField label. Please report if there are any regressions.
        Hide
        Carmen Cristurean added a comment -

        ICEfaces4 trunk revision 45816: verified showcase > autoCompleteEntry and QA ace:autoCompleteEntry test app (Chrome43, FF34).

        Show
        Carmen Cristurean added a comment - ICEfaces4 trunk revision 45816: verified showcase > autoCompleteEntry and QA ace:autoCompleteEntry test app (Chrome43, FF34).

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Brad Kroeger
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: