Skip to content
Snippets Groups Projects
Commit f44e43d4 authored by Frank Naegler's avatar Frank Naegler Committed by Wouter Wolters
Browse files

[BUGFIX] Prevent error for tree in flexform

This patch prevent JS errors in case a tree is rendered in a FlexForm,
before the record was saved for the first time. In this case the data
can’t be loaded and we display a message.

This is a bit hacky but at the moment the best way to fix the issue.

Resolves: #78350
Releases: master
Change-Id: Ic11ae6e5c22711fe9a10fe3287b015ea1d87a30f
Reviewed-on: https://review.typo3.org/50275


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
parent df98a15a
Branches
Tags
No related merge requests found
......@@ -187,6 +187,12 @@ define(['jquery', 'd3'], function ($, d3) {
var me = this;
d3.json(this.settings.dataUrl, function (error, json) {
if (error) throw error;
if (json === null) {
var $container = $(me.wrapper).closest('.t3js-formengine-field-item');
$container.hide();
$container.parent().append('<p class="text-danger">' + TYPO3.lang['tcatree.msg_save_first'] + '</p>');
return;
}
if (Array.isArray(json)) {
//little hack, so we can use json structure prepared by ExtJsJsonTreeRenderer
json = json[0];
......
......@@ -162,6 +162,9 @@ If you click the folder title in the Folder Tree you will see the sub-module loa
<trans-unit id="tcatree.findItem">
<source>Find Item</source>
</trans-unit>
<trans-unit id="tcatree.msg_save_first">
<source>Please save the content element before selecting a category.</source>
</trans-unit>
<trans-unit id="list_module.alttitle">
<source>The Web&gt;List module</source>
</trans-unit>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment