Skip to content

added the example Twig Code for the HTML5 no novalidate attribute #3170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,17 @@ corresponding errors printed out with the form.
but are being prevented by your browser from, for example, submitting
blank fields.

.. code-block:: html+jinja

{# src/Acme/DemoBundle/Resources/views/Default/new.html.twig #}
{{ form(form, {'attr': {'novalidate': 'novalidate'}}) }}

.. code-block:: html+php

<?php echo $view['form']->form($form, array(
'attr' => array('novalidate' => 'novalidate'),
)) ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think echo let's you get away without a semicolon but careful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would also prefer to add a semicolon, but in the existing examples like http://symfony.com/doc/current/book/forms.html#rendering-the-form there are no semicolons at the end.


Validation is a very powerful feature of Symfony2 and has its own
:doc:`dedicated chapter </book/validation>`.

Expand Down