Issue
- When editing or creating new web contents based on a custom structure, the information may be inconsistent, fields may be disabled and non editable, or related errors may be observed.
- This is an example of a web content that needs to be edited but its contents are disabled:

-
We can also see a javascript error in the console that looks like:

Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at component.getParsedValue (?browserId=other&minifierType=&languageId=en_US&b=7210&t=1598515940278&/o/frontend-js-web/aui/aui-tree-io/aui-tree-io-min.js&/o/frontend-js-web/aui/aui-tree-paginator/aui-tree-paginator-min.js&/o/frontend-js-web/aui/aui-tree-node/aui-tree-node-min.js&/o/frontend-js-web/aui/aui-tree-view/aui-tree-view-min.js&/o/layout-taglib/layouts_tree/js/layouts_tree.js&/o/layout-taglib/layouts_tree/js/layouts_tree_node_radio.js&/o/layout-taglib/layouts_tree/js/layouts_tree_radio.js&/o/layout-taglib/layouts_tree/js/layouts_tree_node_task.js&/o/layout-taglib/layouts_tree/js/layouts_tree_selectable.js&/o/dynamic-data-mapping-web/js/ddm_form.js&/o/frontend-js-web/aui/autocomplete-sources/autocomplete-sources-min.js&/o/frontend-js-web/aui/autocomplete-list/lang/autocomplete-list_en.js&/o/frontend-js-web/aui/shim-plugin/shim-plugin-min.js&/o/frontend-js-web/aui/autocomplete-list/autocomplete-list-min.js&/o/frontend-js-web/aui/autocomplete-list-keys/autocomplete-list-keys-min.js:96)
{...}
Environment
- Liferay DXP 7.1
- Liferay DXP 7.2
Resolution
- In some of the cases the root cause of these errors is within the code of the custom structure. In many occasions the empty string is not correctly specified and then javascript parsing errors occur, leading to the observed problematic scenarios.
- This is an example of a structure's field with an incorrect format for the empty strings:
{
"label": {
"es_ES": " Version pdf "
},
"predefinedValue": {
"es_ES": " "
},
"style": {
"es_ES": ""
},
"tip": {
"es_ES": " "
},
"dataType": "document-library",
...
"type": "ddm-documentlibrary"
}
} - The correct one should be:
{
"label": {
"es_ES": " Version pdf "
},
"predefinedValue": {
"es_ES": ""
},
"style": {
"es_ES": ""
},
"tip": {
"es_ES": ""
},
"dataType": "document-library",
...
"type": "ddm-documentlibrary"
}
} - As a summary, empty strings must be specified as "", with no blank spaces inside.