I use Symfony 4.1, and I try a simple usage of form builder :
$builder
->add('name', TextType::class)
->add('phone', TelType::class)
->add('password', RepeatedType::class, array(
'type' => PasswordType::class,
'invalid_message' => 'Passwords don\'t match',
'options' => array('attr' => array('class' => 'password-field')),
'required' => false,
'first_options' => array('label' => 'Password'),
'second_options' => array('label' => 'Password confirmation'),
'mapped' => false,
))
Run Code Online (Sandbox Code Playgroud)
I got the error :
The option "invalid_message" does not exist. Defined options are ....
I don't find any informations on it, I just tried to copy the example from Symfony Doc : https://symfony.com/doc/current/reference/forms/types/repeated.html
Do I need to import something ?
该invalid_message选项所属的选项在组件可用时FormTypeValidatorExtension加载。ValidatorExtensionValidator
您需要安装此组件才能启用验证器选项:
composer require symfony/validator
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
554 次 |
| 最近记录: |