From 09b7b37683bf9bf4507c6723e5c04c8717020ec4 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 13 Nov 2014 20:11:58 -0500 Subject: [PATCH 1/2] Modifying the best practice to use form_start() instead of
+ {{ form_start(form, {'attr': {'class': 'my-form-class'} }) }} {{ form_widget(form) }} -
- -.. best-practice:: - - Don't use the ``form()`` or ``form_start()`` functions to render the - starting and ending form tags. - -Experienced Symfony developers will recognize that we're rendering the ``
`` -tags manually instead of using the ``form_start()`` or ``form()`` functions. -While those are convenient, they take away from some clarity with little -benefit. - -.. tip:: - - The exception is a delete form because it's really just one button and - so benefits from some of these extra shortcuts. + {{ form_end(form) }} If you need more control over how your fields are rendered, then you should remove the ``form_widget(form)`` function and render your fields individually. From 24902bc7c798e9fbb46dc6ee0d536d11255e1e63 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 18 Nov 2014 19:38:04 +0100 Subject: [PATCH 2/2] Fixed typo --- best_practices/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/best_practices/forms.rst b/best_practices/forms.rst index 6f62eaf19d9..883f2c8a998 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -157,7 +157,7 @@ There are a lot of ways to render your form, ranging from rendering the entire thing in one line to rendering each part of each field independently. The best way depends on how much customization you need. -One of thhe simplest ways - which is especially useful during development - +One of the simplest ways - which is especially useful during development - is to render the form tags and use ``form_widget()`` to render all of the fields: