String char
Purpose: single words, any values, short text strings
Field type in SQL table: char and varchar
Additional parameters:
length
Purpose: exact required field length (in utf-8 characters)
Possible values: positive integer
Default: null
min_length
Purpose: mandatory minimum string length
Possible values: positive integer
Default: null
max_length
Purpose: maximum possible string length
Possible values: positive integer
Default: null
min_max_length
Purpose: maximum and minimum string lengths
Possible values: positive integers, separated by commas
Default: null
hidden
Purpose: ability to create hidden fields, used mainly in Creating forms
Possible values: true, false
Default: false
regexp
Purpose: mandatory match with a regular expression. Many data types derived from char have a specified regexp property by default (e.g. email, redirect). More details in the section Form field validation rules.
Possible values: PHP regular expressions in the form '/[a-z]{5}/'
Default: null
captcha
Purpose: the ability to add a verification code to a text field in a form
Possible values: path from the project root to the file that generates the image (without the initial '/')
Default: null
Examples:
['Title', 'char', 'title']
['Name', 'char', 'name', ['required' => true, 'min_length' => 5]]
['Article', 'char', 'articul', ['required' => true, 'unique' => true, 'min_max_length' => '4.8']]
['Security Code', 'char', 'captcha', ['required' => true, 'captcha' => 'extra/captcha-simple/']]
['Skype', 'char', 'skype', ['regexp' => '/^w+$/']]
Previous section
Boolean