Bug #66688

Story #69712: Further FormEngine development

FormEngine: returnFieldJS() for type=text eval not implemented

Added by Christian Kuhn over 5 years ago. Updated 2 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2015-04-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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


Related issues

Related to TYPO3 Core - Epic #63846: Refactoring of form element classesClosedFrank Naegler2014-12-14

Actions
Related to TYPO3 Core - Bug #61370: Missing feature with eval user functionClosed2014-09-05

Actions
#1

Updated by Christian Kuhn over 5 years ago

Also, documentation of "deevaluateFieldValue()" is completely missing in documentation.

#2

Updated by Christian Kuhn about 5 years ago

  • Parent task set to #69712
#3

Updated by Riccardo De Contardi almost 5 years ago

  • Category set to FormEngine aka TCEforms
#5

Updated by Georg Tiefenbrunn about 1 year 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

#6

Updated by Gerrit Code Review 3 months 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

#7

Updated by Christian Kuhn 2 months 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.

Also available in: Atom PDF