Core API
4.2.5. ['columns'][fieldname]['config'] / TYPE: "input"
The type "input" generates an <input> field, possibly with additional features applied.

|
Key |
Datatype |
Description |
Scope |
|---|---|---|---|
|
type |
string |
[Must be set to "input"] |
Display / Proc. |
|
size |
integer |
Abstract value for the width of the <input> field. To set the input field to the full width of the form area, use the value 48. Default is 30. |
Display |
|
max |
integer |
Value for the "maxlength" attribute of the <input> field. If the form element edits a varchar(40) field in the database you should also set this value to 40. |
Display |
|
default |
string |
The default value |
Display / Proc. |
|
eval |
list of keywords |
Configuration of field evaluation. Some of these evaluation keywords will trigger a JavaScript pre-evaluation in the form. Other evaluations will be performed in the backend. The eval-functions will be executed in the list-order.
Keywords:
All the above evaluations (unless noted) are done by JavaScript with the functions found in the script t3lib/jsfunc.evalfield.js "(TCE)" means the evaluation is done in the TCE on the server. The class used for this is t3lib_TCEmain.
Example: Setting the field to evaluate the input to a date returned to the database in UNIX-time (seconds)
'eval' => 'date', Trimming the value for white space before storing in the database (important for varchar fields!) 'eval' => 'trim', 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' User defined form evaluations: You can supply your own form evaluations in an extension by creating a class with two functions, one which returns the JavaScript code for client side validation called returnFieldJS() and one which does the server side validation called evaluateFieldValue(). The function evaluateFieldValue() has 3 arguments:
Example: class.tx_exampleextraevaluations_extraeval1.php:
?> ext_localconf.php
?> Feel free to download the example extension as a T3X file. |
Display / Proc. |
|
is_in |
string |
If the evaluation type "is_in" (see above, under key "eval") is used for evaluation, then the characters in the input string should be found in this string as well. |
Display / Proc. |
|
checkbox |
string |
If defined (even empty), a checkbox is placed before the input field. If a value other than the value of 'checkbox' (this value) appears in the input-field the checkbox is checked. Example: 'checkbox' => '123',
If you set this value then entering "12345" in the field will render this:
But if you either uncheck the checkbox or just enter the value "123" you will an empty input field and no checkbox set - however the value of the field will be "123":
This feature is useful for date-fields for instance. In such cases the checkbox will allow people to quickly remove the date setting (equal to setting the date to zero which actually means 1-1 1970 or something like that).
Example listing: 'config' => Array ( 'type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', 'checkbox' => '0', 'default' => '0' ) Will create a field like this below. Checking the checkbox will insert the date of the current day. Unchecking the checkbox will just remove the value and silently sent a zero to the server (since the value of the key "checkbox" is set to "0").
|
Display / Proc. |
|
range |
array |
An array which defines an integer range within which the value must be.
Keys: "lower": Defines the lower integer value. "upper": Defines the upper integer value.
You can specify both or only one of them.
Notice: This feature is evaluated on the server only so any regulation of the value will have happend after saving the form.
Example: Limits an integer to be within the range 10 to 1000:
'eval' => 'int',
'range' => array('lower' => 10,'upper' => 1000), In this example the upper limit is set to the last day in year 2020 while the lowest possible value is set to the date of yesterday.
'range' => Array (
'upper' => mktime(0,0,0,12,31,2020),
'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
)
|
Proc. |
|
wizards |
array |
[See section later for options] |
Display |
Now follows some codelistings as examples:
Example: A "date" field
This is the typical configuration for a date field, like "starttime":
'starttime' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.starttime',
'config' => Array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0'
)
),
Example: A "username" field
In this example the field is for entering a username (from "fe_users"). A number of requirements are imposed onto the field, namely that it must be unique within the page where the record is stored, must be in lowercase and without spaces in it:
'username' => Array (
'label' => 'LLL:EXT:cms/locallang_tca.php:fe_users.username',
'config' => Array (
'type' => 'input',
'size' => '20',
'max' => '50',
'eval' => 'nospace,lower,uniqueInPid,required'
)
),
Example: A typical input field
This is just a very typical configuration which sets the size and a character limit to the field. In addition the input value is trimmed for surrounding whitespace which is a very good idea when you enter values into varchar fields.
'name' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.name',
'config' => Array (
'type' => 'input',
'size' => '40',
'eval' => 'trim',
'max' => '80'
)
),
Example: Required values
Here the field is required to be filled in:
'title' => Array (
'label' => 'LLL:EXT:cms/locallang_tca.php:fe_groups.title',
'config' => Array (
'type' => 'input',
'size' => '20',
'max' => '20',
'eval' => 'trim,required'
)
),