Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-1332

SelectOption "selected" state is not being set for dialog select control

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 3.0.3
    • 3.0.1
    • templating
    • None

    Description

      In one of my custom dialogs, I have a "select" control to let the user pick from a few different priority options (highest, high, normal, low, lowest). I have set "selected" to be true on the normal priority option. However, every time the dialog opened, the highest option was selected, not the normal one. To work around this, I had to move the normal item to be first in the list, so that the user did not have to remember to change the priority every time they saved the other data in the dialog. The "spacer" property that is present in many of the sample dialogs is also affected by this.

      After digging through the info.magnolia.cms.gui.dialog.DialogSelect class, it looks like this selected property is being lost in the drawHtml() method. The selected state is being set initially in the setOptions(Content) method, but then in drawHtml(), starting at line 130, this list gets iterated through, new SelectOption objects are created each time through on line 132, but only the label and value are passed along.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              pbaerfuss Philipp Bärfuss
              mirandajones Miranda Jones
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD