ICEfaces
  1. ICEfaces
  2. ICE-9427

ace:comboBox - Issues when SelectItem label and value don't match

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.2.0.GA, EE-3.3.0.GA
    • Fix Version/s: EE-3.3.0.GA_P01, 4.0.BETA, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All
    • Assignee Priority:
      P1
    • Salesforce Case Reference:
    • Affects:
      Compatibility/Configuration

      Description

      There are a few issues when using the ace:comboBox with a list of SelectItem objects where the label and value objects are not the same. In this scenario, the label is the descriptive element which should be shown on the UI. The value is set as a database key, which is represented by a number.

      The following issues are seen:
       - The drop down shows the correct descriptions, but when selecting via the mouse/keyboard the 'value' is shown as selected not the label.
       - When typing into the input field, the 'auto complete' functionality does not work. The option typed in does not get highlighted in the drop down.

        Issue Links

          Activity

          Hide
          Arran Mccullough added a comment -

          Attached source code for test case.

          Show
          Arran Mccullough added a comment - Attached source code for test case.
          Hide
          Arturo Zambrano added a comment -

          These are not really issues per se, but the way that the component works right now. Fixing this issues means changing the current behaviour, unless we make it configurable for the user to work with labels or directly with values.

          Since ace:comboBox is a combination of ace:selectMenu and ace:autoCompleteEntry, it makes sense to show labels that are different than the value in the drop-down menu, but the string that populates the text field after an option is selected had to be the actual value, and not the label. This is so, because the value of the text field gets submitted in the request and is decoded and processed in the server, just like ace:autoCompleteEntry.

          In order to show the label text in the text field instead of the value text, we need a separate hidden input field to submit the value text, while we show the label text in the main field. This is already done on my machine and works well. The rest is just a matter of updating the visible and the hidden field with the label and value strings, respectively. We just need to be sure if we want to make this configurable or not.

          Show
          Arturo Zambrano added a comment - These are not really issues per se, but the way that the component works right now. Fixing this issues means changing the current behaviour, unless we make it configurable for the user to work with labels or directly with values. Since ace:comboBox is a combination of ace:selectMenu and ace:autoCompleteEntry, it makes sense to show labels that are different than the value in the drop-down menu, but the string that populates the text field after an option is selected had to be the actual value, and not the label. This is so, because the value of the text field gets submitted in the request and is decoded and processed in the server, just like ace:autoCompleteEntry. In order to show the label text in the text field instead of the value text, we need a separate hidden input field to submit the value text, while we show the label text in the main field. This is already done on my machine and works well. The rest is just a matter of updating the visible and the hidden field with the label and value strings, respectively. We just need to be sure if we want to make this configurable or not.
          Hide
          Ken Fyten added a comment -

          If the label is defined, we should present it in the list and edit it in the input field.

          If the label is not defined, we should present the converted value in the list and edit it in the input field.

          We will document this change as potentially affecting existing apps. and will not make it configurable since this is the "correct" behavior based on h:selectOneMenu behavior.

          Show
          Ken Fyten added a comment - If the label is defined, we should present it in the list and edit it in the input field. If the label is not defined, we should present the converted value in the list and edit it in the input field. We will document this change as potentially affecting existing apps. and will not make it configurable since this is the "correct" behavior based on h:selectOneMenu behavior.
          Hide
          Arturo Zambrano added a comment - - edited

          Committed changes to trunk at revision 37222 and to p01 tag at revision 37223.

          Added improved converter test case to QA's ComboBox test app at revision 35017.

          The changes consist of:

          • Making the actual component value be determined by a hidden field and not by the text field the user interacts with.
          • Displaying the label string in the text field when the user selects an option item, while populating the hidden field with the actual value.
          • Basing the input acceleration functionality on the label strings.
          • Basing the filtering/autocomplete functionality on the label strings.
          • Modifying the renderer to convert the item values to strings when producing the list of options, and using such value as the label if one wasn't defined.
          Show
          Arturo Zambrano added a comment - - edited Committed changes to trunk at revision 37222 and to p01 tag at revision 37223. Added improved converter test case to QA's ComboBox test app at revision 35017. The changes consist of: Making the actual component value be determined by a hidden field and not by the text field the user interacts with. Displaying the label string in the text field when the user selects an option item, while populating the hidden field with the actual value. Basing the input acceleration functionality on the label strings. Basing the filtering/autocomplete functionality on the label strings. Modifying the renderer to convert the item values to strings when producing the list of options, and using such value as the label if one wasn't defined.
          Hide
          Arturo Zambrano added a comment -

          Added line that was missing when porting the fix, at revision 37231.

          Show
          Arturo Zambrano added a comment - Added line that was missing when porting the fix, at revision 37231.
          Hide
          Carmen Cristurean added a comment -

          Re-tested with icefaces-ee-3.3.0.GA_P01 rev# 37231; on the Combo Box - Overview and Filtering demos, when first time loading the page, selecting the province does not persist the selection in the component, although the output text renders the selection. This occurs in all browsers.

          Show
          Carmen Cristurean added a comment - Re-tested with icefaces-ee-3.3.0.GA_P01 rev# 37231; on the Combo Box - Overview and Filtering demos, when first time loading the page, selecting the province does not persist the selection in the component, although the output text renders the selection. This occurs in all browsers.
          Hide
          Arturo Zambrano added a comment -

          Fixed last issue at revision 37251 in the trunk and at revsion 37252 in the p01 tag.

          In cases like the overview demo in the showcase, a second combobox is rendered when a selection is made in the first one, so this causes a full container update, which includes the first combobox. The value wasn't persisting because the new changes read the label values from the DOM, and the code was doing so at a point where these nodes weren't ready yet. This was fixed by reading the value from the model.

          Show
          Arturo Zambrano added a comment - Fixed last issue at revision 37251 in the trunk and at revsion 37252 in the p01 tag. In cases like the overview demo in the showcase, a second combobox is rendered when a selection is made in the first one, so this causes a full container update, which includes the first combobox. The value wasn't persisting because the new changes read the label values from the DOM, and the code was doing so at a point where these nodes weren't ready yet. This was fixed by reading the value from the model.
          Hide
          Arturo Zambrano added a comment -

          Fixed javascript errors when typing text and pressing enter, when the value doesn't match any of the options. Committed fix to trunk at revision 37283 and to p01 tag at revision 37284.

          Show
          Arturo Zambrano added a comment - Fixed javascript errors when typing text and pressing enter, when the value doesn't match any of the options. Committed fix to trunk at revision 37283 and to p01 tag at revision 37284.

            People

            • Assignee:
              Arturo Zambrano
              Reporter:
              Arran Mccullough
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: