Bug #18427
closedRequired fields within flexform section elements cause Javascript errors
0%
Description
If a flexform uses section elements with required fields, a Javascript error is generated as soon as the form is loaded and that flexform cannot be saved.
I believe this is related to changeset 2628, which made significant enhancements to section handling. To see the error in action, check out the Scoring Tab within the pb_survey plugin.
The error message is "document[TBE_EDITOR.formname][elementName] has no properties". Once the required eval is removed, the Javascript errors go away because the code causing the error is no longer executed.
(issue imported from #M7829)
Files
Updated by Steffen Kamper over 16 years ago
i fixed the JS Error with the patch.
This is only one half. With IRRE the naming of the field differs from record to record so JS has to search in childs for matching field.
For first i returned true in this case and marked it with TODO
Updated by Oliver Hader over 16 years ago
Hm, how can I test/reproduce this?
I fetched pbsurvey v. 1.2.0 from TER but could not find the string "inline" in the whole extension. Thus, I don't understand, where the IRRE factor comes into this game... Please enlighten me! :)
Updated by Steffen Kamper over 16 years ago
Hi Olly,
fine that you stumble also :-)
This technique is new for me, in flexform the element (eg result) is declared as array with section=1, i think this is the part doing the magic.
To reproduce it following steps:
1) got to a page and create a CE with pbsurvey
2) go to scoring tab, add a element and enter a value for scoring
3) save it
Updated by Oliver Hader over 16 years ago
Thanks Steffen. I can reproduce this behaviour resulting in my back-end session getting cleared.
This new technique for flexforms feels like IRRE, but isn't. That's why I stumbled and was astonished how this could be related to IRRE if it isn't defined anywhere in the pbsurvey extension.
Updated by Steffen Kamper over 16 years ago
I would propose to use the patch as first step so it will work (only required will not be checked in this special case)
Secondly the required check in eval script should be enhanced, i have no quick solution herefore, i also miss any documentation about this feature.
Updated by Oliver Hader over 16 years ago
I've attached a new patch which is very similar to Steffen's.
Currently there's no other solution to fix it since it goes much deeper to handle the flexform thingy which ignores nearly any other TYPO3 parts...
Thus, the bugfix is to avoid the JavaScript errors - a real bugfix would be to rewrite Kasper's dynamic flexform fields...