Skip to content
Snippets Groups Projects
Commit 57abab16 authored by Viktor Holovachek's avatar Viktor Holovachek
Browse files

Issue #3500182 - Add new examples

parent 9aee975b
No related branches found
Tags 7.x-5.7
1 merge request!76Issue #3500182 - Add new examples
Pipeline #405819 passed with warnings
......@@ -46,6 +46,38 @@ class SimpleForm extends FormBase {
'#required' => TRUE,
];
$form['mail'] = [
'#type' => 'textfield',
'#title' => $this->t('Email'),
'#description' => $this->t('Email must be valid e-mail address.'),
'#validators' => ['email'],
'#required' => TRUE,
];
$form['range'] = [
'#type' => 'textfield',
'#title' => $this->t('Range'),
'#description' => $this->t('The value should be between 0 and 100.'),
'#validators' => ['rule' => 'range[0, 100]'],
'#required' => TRUE,
];
$form['ip'] = [
'#type' => 'textfield',
'#title' => $this->t('IP address'),
'#description' => $this->t('The value should be valid IP address. e.g. 127.0.0.1'),
'#validators' => ['ipv4'],
'#required' => TRUE,
];
$form['url'] = [
'#type' => 'textfield',
'#title' => $this->t('URL'),
'#description' => $this->t('The value should be valid absolute URL. e.g. http://example.com'),
'#validators' => ['url[absolute]'],
'#required' => TRUE,
];
// Group submit handlers in an actions element with a key of "actions" so
// that it gets styled correctly, and so that other modules may add actions
// to the form. This is not required, but is convention.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment