The tabindex of the widget and challenge (optional)
callback
The name of your callback function to be executed when the user submits a successful CAPTCHA response. The user's response, g-recaptcha-response, will be the input for your callback function. (optional)
expired-callback
The name of your callback function to be executed when the recaptcha response expires and the user needs to solve a new CAPTCHA. (optional)
Set field mandatory. You can add this contraint like this.
$form->addConstraint('my_field', 'required', 'My field is required');
Copied!
Email
If set, the field must be filled with valid email. You can add this contraint like this.
$form->addConstraint('my_field', 'email', 'My field must be an email');
Copied!
Sameas
If set, the field must be filled with the same value as a other field. For password or email confirmation for example. You can add this contraint like this.
$form->addConstraint('my_field_confirmation', 'sameas', 'Confirmation is not valid', array('sameas' => 'my_field'));
Copied!
Unique
If set, the field must be filled with an unique value. You can add this contraint like this.
$form->addConstraint('username', 'unique', 'Username must be unique', array('repository' => $this->frontenduserRepository));
Copied!
Custom
Custom contraint. You can add this contraint like this.
$form->addConstraint('username', 'custom', 'Custom validation not valid', array('method' => function($value, $form) {
// your code here. return true if result is valid. Else, false
}));
Copied!
Filesize
For upload element. Check the upload file max size. You can add this contraint like this.
$form->addConstraint('file', 'filesize', 'File too big', array('maxsize' => '2M'));
Copied!
Fileextension
For upload element. Check the upload file max size. You can add this contraint like this.
$form->addConstraint('file', 'fileextention', 'Your file must be a picture', array('allowed' => 'jpg,gif,png'));
Copied!
Templating with fluid
Table of content:
Templating a form
Example :
Php code
$mymodel = $this->myModelRepository->findByUid($modelIdentifier);
$form = \Ameos\AmeosForm\Form\Factory::make('tx_myplugin', $mymodel);
$form->add('name', 'text')->addConstraint('name', 'required', 'Name is mandatory');
$form->add('email', 'email')->addConstraint('email', 'email', 'Email is not valid');
$form->add('submit', 'submit', array('label' => 'Send'));
$this->view->assign('form', $form);
Set field mandatory. You can add this validator like this.
$form->validator('my_field', 'required', 'My field is required');
Copied!
Email
If set, the field must be filled with valid email. You can add this validator like this.
$form->validator('my_field', 'email', 'My field must be an email');
Copied!
Sameas
If set, the field must be filled with the same value as a other field. For password or email confirmation for example. You can add this validator like this.
$form->validator('my_field_confirmation', 'sameas', 'Confirmation is not valid', array('sameas' => 'my_field'));
Copied!
Unique
If set, the field must be filled with an unique value. You can add this validator like this.
$form->validator('username', 'unique', 'Username must be unique', array('repository' => $this->frontenduserRepository));
Copied!
Custom
Custom validator. You can add this validator like this.
$form->validator('username', 'custom', 'Custom validation not valid', array('method' => function($value, $form) {
// your code here. return true if result is valid. Else, false
}));
Copied!
Filesize
For upload element. Check the upload file max size. You can add this validator like this.
$form->validator('file', 'filesize', 'File too big', array('maxsize' => '2M'));
Copied!
Fileextension
For upload element. Check the upload file max size. You can add this validator like this.
$form->validator('file', 'fileextention', 'Your file must be a picture', array('allowed' => 'jpg,gif,png'));
Copied!
Reference to the headline
Copy and freely share the link
This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.