0

从模板单击此按钮时:

<form action="{{ path('fos_user_registration_register') }}" method="post">        
   <button class="btn btn-small btn-success" type="submit">S'inscrire</button>                     
</form> 

然后我访问我的UserBundle/Resources/view/Registration/register/html.twig(然后覆盖 FOSUSerBundle 默认表单):

{% extends "FOSUserBundle::layout.html.twig" %}

{% block fos_user_content %}

<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
{{ form_rest(form) }}
<div>
    <input type="submit" value="{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}" />
</div>
 </form>
     {% endblock fos_user_content %}

由于某些原因,尽管我没有提交表单,但出现了所有验证消息(例如请输入用户名)!?

对此有何解释?

如何自定义 FOSUser 模板并重定向 error_message,而不使其出现或更改消息或显示?

4

1 回答 1

1

最后我覆盖了registration_content视图:

   <form action="/projet_etienne_auth/web/app_dev.php/register/"  method="POST"     class="fos_user_registration_register">
  {{ form_errors(form) }}
  {{ form_widget(form._token) }}
 <div>
<label for="fos_user_registration_form_username" class="required">Nom d&#039;utilisateur :</label>
<input type="text" id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="255" pattern=".{2,}" /></div>
<div>
    <label for="fos_user_registration_form_email" class="required">Adresse e-mail :</label>
    <input type="email" id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required" /></div>

<div>
    <label for="fos_user_registration_form_plainPassword_first" class="required">Mot de passe :</label>

    <input type="password" id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required" />
</div>
<div><label for="fos_user_registration_form_plainPassword_second" class="required">Vérification :</label>
    <input type="password" id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required" />
</div><div>
     <input type="submit" value="Enregistrer" />

于 2012-12-18T16:06:47.630 回答