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

          Arran Mccullough created issue -
          Arran Mccullough made changes -
          Field Original Value New Value
          Salesforce Case Reference 5007000000UaBMdAAN
          Hide
          Arran Mccullough added a comment -

          Attached source code for test case.

          Show
          Arran Mccullough added a comment - Attached source code for test case.
          Arran Mccullough made changes -
          Attachment Case12266Example.zip [ 16119 ]
          Ken Fyten made changes -
          Assignee Arturo Zambrano [ artzambrano ]
          Fix Version/s EE-3.3.0.GA_P01 [ 11174 ]
          Fix Version/s 3.4 [ 10770 ]
          Assignee Priority P1 [ 10010 ]
          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.
          Ken Fyten made changes -
          Affects Compatibility/Configuration [ 10002 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #37222 Thu Jul 25 09:29:43 MDT 2013 art.zambrano ICE-9427 ace:comboBox - Issues when SelectItem label and value don't match... fixed
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/combobox/ComboBoxRenderer.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/combobox/combobox.js
          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.
          Arturo Zambrano made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #37230 Thu Jul 25 16:04:58 MDT 2013 art.zambrano ICE-9427 added CSS classes for ignoring parts of the label text when displaying it in the text field
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/ace/combobox/comboBoxFacet.xhtml
          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.
          Arturo Zambrano made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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.
          Carmen Cristurean made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #37251 Fri Jul 26 14:33:11 MDT 2013 art.zambrano ICE-9427 fixed issue with the value not persisting at first selection
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/combobox/combobox.js
          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.
          Arturo Zambrano made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #37283 Wed Jul 31 12:18:27 MDT 2013 art.zambrano ICE-9427 added check to return a valid option item node in getEntryFromContent() function
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/combobox/combobox.js
          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.
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #37329 Wed Aug 07 16:41:48 MDT 2013 art.zambrano ICE-9427 added CSS classes for ignoring parts of the label text when displaying it in the text field
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/ace/combobox/comboBoxFacet.xhtml
          Arturo Zambrano made changes -
          Link This issue blocks ICE-9473 [ ICE-9473 ]
          Ken Fyten made changes -
          Fix Version/s 4.0 [ 11382 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: