Issue Type: Bug Bug
Affects Versions: 5.1.1
Assignee: Unassigned
Components: app framework, forms
Created: 19/Nov/13 7:54 AM
Description:

Steps to recreate:

  • define a select field (SF) in a form (F), with path (P) and repository pointing to a options set.
  • run form F, select field SF options should be ok
  • add a node N in options set path P.
  • run form F, select field SF options does not contain node N.

Expected behavour:
Select field SF options should contain node N.

Where is this bug/How to fix?
In SelectFieldFactory.getSelectFieldOptionDefinition changed order of blocks in if/else, so when path is defined, then build remote options first.

Patch:

SelectFieldFactory.java
diff --git a/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java b/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java
index ecd1ed4..a123c0c 100644
--- a/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java
+++ b/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java
@@ -159,7 +159,10 @@ public class SelectFieldFactory<D extends SelectFieldDefinition> extends Abstrac
     public List<SelectFieldOptionDefinition> getSelectFieldOptionDefinition() {
         List<SelectFieldOptionDefinition> res = new ArrayList<SelectFieldOptionDefinition>();
 
-        if (definition.getOptions() != null && !definition.getOptions().isEmpty()) {
+        if (StringUtils.isNotBlank(definition.getPath())) {
+            // Build an option based on the referred node.
+            buildRemoteOptions(res);
+        } else if (definition.getOptions() != null && !definition.getOptions().isEmpty()) {
             for (SelectFieldOptionDefinition option : definition.getOptions()) {
                 option.setValue(getValue(option));
                 option.setLabel(getMessage(getLabel(option)));
@@ -171,9 +174,6 @@ public class SelectFieldFactory<D extends SelectFieldDefinition> extends Abstrac
                 }
                 res.add(option);
             }
-        } else if (StringUtils.isNotBlank(definition.getPath())) {
-            // Build an option based on the referred node.
-            buildRemoteOptions(res);
         }
 
         return res;
Project: Magnolia UI
Priority: Minor Minor
Reporter: Marek Swiecznik
Security Level: Public
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to