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

Combobox loses it's value if value is entered by user and component is ajax re-rendered


    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
    • Workaround:
      Workaround Exists
    • Workaround Description:

      Use a javascript that copies the value of the input text into the hidden field.

      Use a javascript that copies the value of the input text into the hidden field.


      When a rich:combobox is on a page, with enableManualInput=true, user can type a value in the box that is not in the list of propositions.
      At that moment, the hidden input is properly populated.
      If an ajax request is fired on the page, and the combobox is rerendered, the input text still contains the user value, but the hidden input is empty, and any next submit (ajax or not) empties the bean bound to the combobox object.

      The issue comes from the renderer of the Combobox
      In the class ComboboxRenderer, doEncodeEnd(), at line 560 we see this code :

      String hiddenValue = null;
      if (items.contains(value)) {
      	variables.setVariable("hiddenValue", value);

      which means : "If the value in the field is not part of the list of propositions, do not fill the hidden input with it". The input text is properly filled and it breaks the symetry (user sees a value in the box but another value is saved in the bean).

      If enableManualInput=true, meaning the user can type his own value, there should be no check if the value is in the propositions or not, and the hidden field should be filled the same way the input text is.

      Code should look like :

      String hiddenValue = null;
      if (enableManualInput || items.contains(value)) {
      	variables.setVariable("hiddenValue", value);

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  adubovsky Aleksandr Dubovsky
                  brian.couchman Brian Couchman
                • Votes:
                  0 Vote for this issue
                  0 Start watching this issue


                  • Created: