Bug #17119
closedRTE in child elements overwrites field in parent element
0%
Description
I both parent elemt and child element of an IRRE object contain an RTE field, the content of the child RTE field overwrites the parent RTE on saving.
Scenario:
I created a parent table called "...downloads" and a child table called "...credits". The credit info is set up as a child element of downloads. Both contain a RTE element.
If I create a new downloads item, fill out all fields including the RTE field "description", create a new child element "credits" and fill out its RTE field "credits", too, the RTE content of the parent element is replaced by the content of the "credits" child element after saving. Meaning, both RTE elements now contain the same data. The same happens, if I do save the parent element before creating a "credits" child element. All other fields remain unchanged.
If I edit the RTE field of the parent element afterwards and replace the credits content by the original content for the parent element, everything is saved as intended. No overwriting of foreign fields or something like this. Same happens, if you do create a child element somewhat later by editing the parent object.
Typo3 4.1.1
Linux server
There are no error messages or something like this.
TCA attached
I can provide the whole extension, if requested.
(issue imported from #M5556)
Files
Updated by Oliver Hader over 17 years ago
I can confirm this issue.
The problem is located in the RTEcounter variable in TCEforms. It will be incremented each time a RTE is rendered. When a new child record is rendered using AJAX this process doesn't know how many RTE instances have been created before.
Thus each new dynamically created child has the RTEcounter set to "1" - and so the first RTE instance gets overwritten.
Updated by Oliver Hader over 17 years ago
The attached patch should solve the problem.
On creating new child records now the number of RTE instances is sent with the AJAX call and the RTEcounter variable in TCEforms gets adjusted.
Please test the patch and give me some feedback.
Updated by Gregor over 17 years ago
works perfect for me.
Now, child records save without overwriting the parent object's RTE field.
I did test several combinations of "new parent and creating child records without saving first", "creating parent record, saving, creating child records", "creating parent record, saving, closing, editing, creating child records" etc. All combinations I tried did save without any failures.
Updated by Oliver Hader over 17 years ago
On clicking the "create new record" link more than once - what is okay
in general - TCEforms gets the same value for the $RTEcounter variable.
Thus, it will again overwrite another RTEhtmlarea instance... (argh)
A solution could be to process and index the newly RTE after it has been
fetched from server via AJAX. Currently the index is set by
PHP/TCEforms, in future I could imagine that JavaScript is doing this
dynamically (only in IRRE context, not for regular standard
tt_content!). But to do this there are some changes necessary in
RTEhtmlarea which would be covered by the term "bugfix" and thus could
only be fixed in Trunk.
Updated by Oliver Hader over 17 years ago
I decided to drop the possibility to create more child records during AJAX requests are processed. The createNewRecord function will be locked when fired and gets released when the AJAX request finished (or failed because of a unreachable server).
This behaviour might change again in TYPO3 4.2.0, but for the 4.1 branch its necessary to have get RTE working in IRRE.
The attached patch 0005556_v5.patch is against the current TYPO3_4-1 branch (revision 2402). If you use the release package of TYPO3 4.1.1 and like to test the changes, please use the patch in "0005556_v5_since_411.patch" which envolves bug #17101, #17101 and this one.
Updated by Oliver Hader over 17 years ago
- TYPO3_4-1 (rev. 2422)
- Trunk (rev. 2423)