Hello everyone, I have a problem with switchable fields within a multifield with the TransformerClass MultiValueSubChildrenNodePropertiesTransformer. We need the transformer class to have the reorder possibility for all multiple entries. Currently I am using the switchable field with some other fields in a composite field. The composite field is then placed in the multi field (see code below).
The creation of multiple (for my case links) fields is working well. But after creating a module with this structure I am not able to edit it again. I always get a ClassCastException because the MultiValueField try to cast my SwitchableFieldDefinition into a MultiValueFieldDefinition. Why is it possible to create a module with this configuration but not edit it again? What's going wrong here, maybe I'm using a wrong TransformerClass? Thanks for any help. [code] SwitchableFieldBuilder switchable = cfg.fields.switchable("switchable_link_") .label(linkLabel) .description(description) .required(isRequired) .options( new OptionBuilder().value("option1").label("option1").selected(), new OptionBuilder().value("option2").label("option2")) .layout(Layout.horizontal).fields( cfg.fields.text("text1").label("").required(false), cfg.fields.text("text2").label("").required(false)); ArrayList<AbstractFieldBuilder> someOtherFields = new ArrayList<AbstractFieldBuilder>(); someOtherFields.add(cfg.fields.text("exampleField1").label("").value("")); someOtherFields.add(switchable); AbstractFieldBuilder compositeField = new CompositeFieldBuilder("link") .fields(someOtherFields.toArray(new AbstractFieldBuilder[someOtherFields.size()])) .transformerClass(NoOpCompositeTransformer.class) .layout(Layout.vertical); cfg.fields .multi("multiField") .label(label) .field(compositeField) .transformerClass(MultiValueSubChildrenNodePropertiesTransformer.class) .description("My description"); [/code] This is how my JCR is looking after creating a module: + multiField + 00 + switchable_link_ - option1 : "THEVALUE" - switchable_link_ : "option1" - exampleField1: "VALUE" Where the Exception is thrown: info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer Caused by: java.lang.ClassCastException: info.magnolia.ui.form.field.definition.SwitchableFieldDefinition$$EnhancerByCGLIB$$9da86851 cannot be cast to info.magnolia.ui.form.field.definition.MultiValueFieldDefinition at info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer.getValueFromChildNode(MultiValueSubChildrenNodePropertiesTransformer.java:154) at info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer.getValueFromChildNode(MultiValueSubChildrenNodePropertiesTransformer.java:92) -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=d8508714-5b27-4f8e-bce1-9e4ae88e1bfc ---------------------------------------------------------------- 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: <user-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------