php - Symfony2 errors on form field and parent -
is possible have validation on form keep on field @ same time? trying have errors display @ top of page have red border around error field. also, each of errors on top should have link gives focus on field has error.
if use {{ form_errors(form.title) }}
, don't access {{ form_errors(form) }}
. if use error_bubbling => true
on field don't access {{ form_errors(form.title) }}
. thinking of building errors display in controller, if that, i'm losing twig's functionality.
customize
form_row
block not display error{% block form_row %} <div class="form-group{% if errors|length == 1 %} has-error{% endif %}"> {{ form_label(form, label|default(null)) }} {{ form_widget(form, { 'attr' : { 'class' : 'form-control' } } ) }} </div> {% endblock form_row %}
customize
form_errors
clickable. can create jquery function listen clicks onli
. in functionid
of clickedli
remove relatedfield field id{% block form_errors -%} {% if errors|length > 0 -%} <ul id="allerrors"> {%- error in errors -%} <li id="relatedfield{{ error.id }}">{{ error.message }}</a></li> {%- endfor -%} </ul> {%- endif %} {%- endblock form_errors %}
references
- how customize form rendering - http://symfony.com/doc/current/cookbook/form/form_customization.html
Comments
Post a Comment