Issue Bug Rejected

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

Christian Kuhn 04/30/15, 15:06 updated 09/22/20, 12:35

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

Reviews 1