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.

  1. 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 %} 
  2. customize form_errors clickable. can create jquery function listen clicks on li. in function id of clicked li 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


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -