Deprecation: #89331 - FormEngine legacy functions
See forge#89331
Description
The FormEngine supports global callback functions executed on certain interactions. Such functions were overridden and spread through some extensions which are not related to FormEngine at all.
These functions have been marked as deprecated:
set
Form Value Open Browser () set
Form Value From Browse Win () set
Hidden From List () set
Form Value Manipulate () set
Form Value_ get FObj ()
The function set
is also called by Element
. Extensions not related to FormEngine
are able to override this function and inject custom handling. This approach has been marked as deprecated as well.
Impact
Calling a deprecated function will trigger a warning in the browser console.
Affected Installations
All installations using 3rd party extensions calling any of these deprecated functions are affected.
Migration
Some functions can be used in FormEngine context only from now on. Load the module TYPO3/
and
use the according replacements:
set
- useForm Value Open Browser () Form
insteadEngine. open Popup Window () set
- useForm Value From Browse Win () Form
insteadEngine. set Select Option From External Source () set
- useHidden From List () Form
insteadEngine. update Hidden Field Value From Select () set
- no replacement, this is internal logic for form controls separated into according modulesForm Value Manipulate () set
- useForm Value_ get FObj () Form
insteadEngine. get Form Element ()
If set
is not used within a FormEngine context, it is possible to listen to the
message
event.
Example code:
require(['TYPO3/CMS/Backend/Utility/MessageUtility'], function (MessageUtility) {
window.addEventListener('message', function (e) {
// MessageUtility.MessageUtility is correct as this is not an AMD module
if (!MessageUtility.MessageUtility.verifyOrigin(e.origin)) {
throw 'Denied message sent by ' + e.origin;
}
if (typeof e.data.fieldName === 'undefined') {
throw 'fieldName not defined in message';
}
if (typeof e.data.value === 'undefined') {
throw 'value not defined in message';
}
const result = e.data.value.split('_');
const field = <HTMLInputElement>document.querySelector('input[name="' + e.data.fieldName + '"]');
field.value = result[1];
});
}