我有一个“用户”表单:
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('email', 'repeated', array(
'type' => 'email',
'first_name' => 'Email',
'second_name' => 'Confirm Email',
'invalid_message' => 'The email addresses you entered did not match.',
'error_bubbling' => true
))
->add('password', 'repeated', array(
'type' => 'password',
'first_name' => 'Password',
'second_name' => 'Confirm Password',
'invalid_message' => 'The passwords you entered did not match.',
'error_bubbling' => true
))
;
}
该实体具有以下验证:
/**
* @var string $email
*
* @Assert\NotBlank(message="Please enter an email address")
* @Assert\Email()
* @ORM\Column(name="email", type="string", length=100, unique=true)
*/
private $email;
如果您在表单中输入不匹配的电子邮件地址,即使用户显然输入了某些内容,也会触发@Assert \ NotBlank错误。有没有办法在触发“重复”错误时停止显示“空白”错误?