[BLOSSOM-151] When combine switchable field and select fields if you don't change selected option on select fields, the dialog don't save anything Created: 14/Nov/13  Updated: 21/Nov/14  Resolved: 21/Nov/14

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: 3.0
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Francisco J. Giner Assignee: Tobias Mattsson
Resolution: Cannot Reproduce 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
Date of First Response:

 Description   

When writing a TabFactory to configure a component, if combine a SwitchableField with SelectFields, when launching the configuration of the component (dialog) if you do not choose any option on the selectors, the first values of them are not saved nodes options. I tried to put defaultValue in the selectors or mark as selected the first element of the same but still without saving. An example:

@TabFactory("Content")
public void contentTab(UiConfig cfg, TabBuilder tab) {

    List<Article> news = articleService.findAllByType("News");
    List<Article> posts = articleService.findAllByType("Posts");

    SelectFieldBuilder newsSelector = cfg.fields.select("news").label("Select one");
    for (Article obj : news) {
        OptionBuilder ob = new OptionBuilder()
            .label(obj.getTitle())
            .value(obj.getId());
        newsSelector.options(ob);
    }

    SelectFieldBuilder postSelector = cfg.fields.select("posts").label("Select one");
    for (Article obj : posts) {
        OptionBuilder ob = new OptionBuilder()
            .label(obj.getTitle())
            .value(obj.getId());
        postSelector.options(ob);
    }

    tab.fields(
            cfg.fields.switchable("type_object").label("Type").options(
                new OptionBuilder().value("news").label("News").selected(),
                new OptionBuilder().value("posts").label("Posts")
            ).fields(
                newsSelector,
                postSelector
            )
    );
}


 Comments   
Comment by Tobias Mattsson [ 21/Nov/14 ]

I'm unable to reproduce this in Magnolia 5.3.4. Could have been a UI problem that has been fixed already.

Saving the dialog without touching any of the fields saves the first option. Setting an option to selected in the code correctly saves the selected option.

Generated at Sun Feb 11 23:30:38 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.