0
我已经定制了FOSUserBundle的注册表单,并将其添加到我的BloggerBlogBundle中,但是当我尝试提交注册表单时,它只是说“请输入密码” ......symfony2 FOSUserBundle自定义注册表单验证失败“请输入密码”
这是我registrationFormType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('fname', null, array('label' => 'first name', 'translation_domain' => 'FOSUserBundle'))
->add('lname', null, array('label' => 'last name', 'translation_domain' => 'FOSUserBundle'))
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
->add('category','choice', array(
'choices' => array(
'sport' =>'sport',
'news' => 'news',
'ecommerce' => 'ecommerce',
)))
->add('password', 'repeated', array(
'type' => 'password',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
))
;
}
控制器或路由没有任何问题。请提供您的自定义表格...您是否忘记了密码或您做了什么? – nifr
我已经添加了上面的自定义表格,密码没有被省略。 – mtd
只是为了说清楚...您在表单中提供了两次相同的密码,但表单未验证并且有一个字段错误“请输入密码”? – nifr