[JSFIELD-45] FormFieldsExtractor unable to resolve compositeField in switchableField for non-default language in FormViewWithChangeListener-form Created: 15/Sep/23 Updated: 24/Jan/24 Resolved: 11/Oct/23 |
|
| Status: | Closed |
| Project: | Java Script UI (App and Dialog Fields) |
| Component/s: | None |
| Affects Version/s: | 2.0.2 |
| Fix Version/s: | 2.0.3 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Luca Sanda | Assignee: | Teresa Miyar |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: | |
| Acceptance criteria: |
[ ]*
Error should no longer be thrown + getFormFields(...) should still resolve fields properly
|
| Description |
Steps to reproduce
form:
implementationClass: info.magnolia.ui.javascript.form.FormViewWithChangeListener
$type: tabbedForm
tabs:
general:
label: 'General'
fields:
switchableField:
label: 'Switchable Field'
i18n: true
$type: switchableField
itemProvider:
$type: jcrChildNodeProvider
field:
$type: radioButtonGroupField
layout: horizontal
defaultValue: option
datasource:
$type: optionListDatasource
options:
- name: option
value: option
label: 'Option'
forms:
option:
properties:
option:
$type: compositeField
label: 'Sub Composite Field'
itemProvider:
$type: jcrChildNodeProvider
properties:
text:
label: 'Text'
$type: textField
required: true
javascriptField:
$type: javascriptField
fieldScript: /whatever-path-floats-your-boat/webresources/dialogs/components/custom-chooser.html
height: 200
parameters:
field: javascriptFieldValue
Expected resultsDialog should look the same as German version, just with language specific field values. Actual resultsError gets shown in CMS + Logs reveals strack-trace with the root cause being a NullPointerException occurring in FormFieldsExtractor. (See following file for stacktrace: stacktrace.log WorkaroundError can be circumvented by explicitly adding "i18n: true" to the "Sub Composite Field". Development notesThe error originates from "FormfieldsExtractor.getCompositeFormFields" which tries to get the appropriate representation from the subEditor. Since i18n is not enabled for "option" (= "Sub Composite Field") it tries resolving to default-locale. Since the representations only contain the key "en" though it resolves to null, which gets passed along to "getFormFields(...)" then "getSimpleFormFields(...)" and finally results in the attempted FormPresenter-resolution via "FormViewIntrospector.getFormPresenter(formView)" -> chained ".getBoundFields(locale)" then throws a NullPointerException. |