Ard Schrijvers pushed to branch feature/HSTTWO-3792 at cms-community / hippo-site-toolkit
Commits: b9924de4 by Ard Schrijvers at 2016-09-07T10:25:55+02:00 HSTTWO-3792 Account for feedback from Oscar: - mixin MIXIN_FORM_DATA_PAYLOAD should only be set if the flat structure feature is enabled - remove usage of FormField#getValues - - - - - 1 changed file: - client/src/main/java/org/hippoecm/hst/component/support/forms/FormUtils.java Changes: ===================================== client/src/main/java/org/hippoecm/hst/component/support/forms/FormUtils.java ===================================== --- a/client/src/main/java/org/hippoecm/hst/component/support/forms/FormUtils.java +++ b/client/src/main/java/org/hippoecm/hst/component/support/forms/FormUtils.java @@ -46,6 +46,7 @@ import org.hippoecm.hst.site.HstServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static javax.jcr.nodetype.NodeType.MIX_REFERENCEABLE; import static org.hippoecm.hst.core.component.HstRequest.RESOURCE_PHASE; import static org.hippoecm.hst.site.HstServices.getComponentManager; import static org.onehippo.repository.util.JcrConstants.MIX_REFERENCEABLE; @@ -263,9 +264,9 @@ public class FormUtils { } postedFormDataNode.addMixin(MIX_REFERENCEABLE); - postedFormDataNode.addMixin(MIXIN_FORM_DATA_PAYLOAD); if (getComponentManager().getContainerConfiguration().getBoolean(FORM_DATA_FLAT_STORAGE_CONFIG_PROP, true)) { + postedFormDataNode.addMixin(MIXIN_FORM_DATA_PAYLOAD); final String json = new ObjectMapper().writeValueAsString(formMap.getFormMap()); postedFormDataNode.setProperty(PROPERTY_FORM_DATA_PAYLOAD, json); } else { @@ -273,9 +274,9 @@ public class FormUtils { FormField field = entry.getValue(); Node fieldNode = postedFormDataNode.addNode(HST_FORM_DATA_NODE, HST_FORM_DATA_NODE); fieldNode.setProperty(HST_FORM_FIELD_NAME, field.getName()); - Map<String, String> values = field.getValues(); - if (values.size() > 0) { - fieldNode.setProperty(HST_FORM_FIELD_DATA, values.values().toArray(new String[values.size()])); + List<String> valueList = field.getValueList(); + if (valueList.size() > 0) { + fieldNode.setProperty(HST_FORM_FIELD_DATA, valueList.toArray(new String[valueList.size()])); } List<String> messages = field.getMessages(); if (messages.size() > 0) { View it on GitLab: https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/b9924de4fd91c0cd58f8aea0f125f7b1af9ea1e4
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn