Bug #66688
closedStory #69712: Further FormEngine development
FormEngine: returnFieldJS() for type=text eval not implemented
0%
Description
It is documented in TCA reference that type=text can be eval'd with returnFieldJS, but that is not implemented.
A section similar to this is missing in TextElement:
// Going through all custom evaluations configured for this field foreach ($evalList as $evalData) { $evalObj = GeneralUtility::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData] . ':&' . $evalData); if (is_object($evalObj) && method_exists($evalObj, 'returnFieldJS')) { $resultArray['extJSCODE'] .= LF . 'TBE_EDITOR.customEvalFunctions[' . GeneralUtility::quoteJSvalue($evalData) . '] = function(value) {' . $evalObj->returnFieldJS() . '}'; $paramsList = GeneralUtility::quoteJSvalue($parameterArray['itemFormElName']) . ',' . GeneralUtility::quoteJSvalue($evalData) . ',' . GeneralUtility::quoteJSvalue(trim($config['is_in'])) . ',' . ($config['checkbox'] ? 1 : 0) . ',' . GeneralUtility::quoteJSvalue($config['checkbox']); $parameterArray['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet' => 'typo3form.fieldGet(' . $paramsList . ');'), $parameterArray['fieldChangeFunc']); } }
This does not work since fieldGet JS works on _hr input names, which is not done for type=text, but for type=input only ...
This issue could be solved if the _hr fieldname madness is solved.
ext:styleguide has examples for this in input_21 and type_9
Also, the documentation should be improved and namespaced, and the tx_ prefix is not required anymore, see the two styleguide fields for examples.
http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Text/Index.html#eval
Updated by Christian Kuhn over 9 years ago
Also, documentation of "deevaluateFieldValue()" is completely missing in documentation.
Updated by Riccardo De Contardi almost 9 years ago
- Category set to FormEngine aka TCEforms
Updated by Stephan Großberndt about 8 years ago
Updated by Georg Tiefenbrunn about 5 years ago
Still present in 9.5 LTS
https://docs.typo3.org/m/typo3/reference-tca/9.5/en-us/ColumnsConfig/Type/Text.html#eval
You can supply own form evaluations in an extension by creating a class with three functions, one which returns the JavaScript code for client side validation called returnFieldJS() and two for the server side: deevaluateFieldValue() called when opening the record and evaluateFieldValue() called for validation when saving the record:
As Christian said: returnFieldJS() is not implemented/working for type=text
Updated by Gerrit Code Review about 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65513
Updated by Christian Kuhn about 4 years ago
- Status changed from Under Review to Rejected
We discussed the issue again and abandoned the patch:
The 'returnFieldJs' functionality is quite ugly in type=input already and especially collides with the goal to remove inline javascript. Thus, it should have a new issue to refactor this, anyway. This also means, we'll not implement that for type=text now, but instead may come up with a solid solution for both input and text later.
I'll also adapt the docs now that returnFieldJs is not available on type=text.
If anyone needs a feature like that right now, just use the formEngine NodeFactory to register an own renderType to implement something as a workaround for extension authors.
Closing the issue.