[MAGNOLIA-1332] SelectOption "selected" state is not being set for dialog select control Created: 31/Jan/07  Updated: 23/Jan/13  Resolved: 21/Mar/07

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: 3.0.1
Fix Version/s: 3.0.3

Type: Bug Priority: Minor
Reporter: Miranda Jones Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 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.


Generated at Mon Feb 12 03:25:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.