Skip to content

Latest commit

 

History

History
executable file
·
22 lines (16 loc) · 552 Bytes

2_2.md

File metadata and controls

executable file
·
22 lines (16 loc) · 552 Bytes

2.2 Forms in sub-requests

The JavaScript initializer only knows about forms that were queued before init_js_validation() is rendered.

If your form is rendered in a sub-request, for example:

<div id="email">
    {{ render(controller('App\\Controller\\EmailController::sendEmail')) }}
</div>

the initializer in the parent template may not know about that form. Render the initializer in the sub-template that renders the form:

{# templates/email/send_email.html.twig #}

{{ form(form) }}
{{ init_js_validation(form) }}