Path: $GLOBALS[‘TCA’][$table][‘columns’][$field][‘config’] Type: string (list of keywords) Scope: Display / Proc. RenderTypes: default, colorpicker, inputLink
Configuration of field evaluation.
- Allows only a-zA-Z characters.
- Same as “alpha” but allows also “0-9”
- Same as “alphanum” but allows also “_” and “-” chars.
- Allows a domain name such as
example.organd automatically transforms the value to punicode if needed.
- Converts the input to a floating point with 2 decimal positions, using the “.” (period) as the decimal delimited (accepts also “,” for the same).
- This type adds a server-side validation of an email address. If the input does not contain a valid email address, a flash message warning will be displayed.
- Evaluates the input to an integer.
- Will filter out any character in the input string which is not found in the string entered in the property is_in.
- Converts the string to lowercase (only A-Z plus a selected set of Western European special chars).
- Removes all occurrences of space characters (
- An empty value (string) will be stored as
NULLin the database, requires a proper sql definition.
- Allows only 0-9 characters in the field.
Will show “*******” in the field after entering the value and moving to another field. Thus passwords can be protected from display in the field.
The value is visible while it is being entered!
- A non-empty value is required in the field (otherwise the form cannot be saved).
- The value will be hashed using the password hash configuration for BE for all tables except
fe_user, where the password hash configuration for FE is used. Note this eval is typically only used core internally for tables
- The value in the field will have white spaces around it trimmed away.
Requires the field to be unique for the whole table. Evaluated on the server only.
When selecting on unique-fields, make sure to select using
AND pid>=0since the field can contain duplicate values in other versions of records (always having PID = -1). This also means that if you are using versioning on a table where the unique-feature is used you cannot set the field to be truly unique in the database either!
- Requires the field to be unique for the current PID among other records on the same page. Evaluated on the server only.
- Converts to uppercase (only A-Z plus a selected set of Western European special chars).
- Evaluates the input to a year between 1970 and 2038. If you need any year, then use “int” evaluation instead.
- User defined form evaluations.
Trim white space¶
Trimming the value for white space before storing in the database:
'aField' => [ 'label' => 'aLabel', 'config' => [ 'type' => 'input', 'eval' => 'trim', ], ],
Combine eval rules¶
By this configuration the field will be stripped for any space characters, converted to lowercase, only accepted if filled in and on the server the value is required to be unique for all records from this table:
'eval' => 'nospace,lower,unique,required'
Custom eval rules¶
You can supply own form evaluations in an extension by creating a class with three functions, one which returns
returnFieldJS() and two for the server side:
deevaluateFieldValue() called when opening the record and
evaluateFieldValue() called for validation when
saving the record:
// Register the class to be available in 'eval' of TCA $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals']['Vendor\\Extension\\Evaluation\\ExampleEvaluation'] = '';
'columns' => [ 'example_field' => [ 'config' => [ 'type' => 'text', 'eval' => 'trim,Vendor\\Extension\\Evaluation\\ExampleEvaluation,required' ], ], ],