File tree Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -157,29 +157,15 @@ There are a lot of ways to render your form, ranging from rendering the entire
157
157
thing in one line to rendering each part of each field independently. The
158
158
best way depends on how much customization you need.
159
159
160
- The simplest way - which is especially useful during development - is to render
161
- the form tags manually and then use ``form_widget() `` to render all of the fields:
160
+ One of thhe simplest ways - which is especially useful during development -
161
+ is to render the form tags and use ``form_widget() `` to render all of the
162
+ fields:
162
163
163
164
.. code-block :: html+jinja
164
165
165
- < form method="POST" {{ form_enctype( form) }}>
166
+ {{ form_start( form, {'attr': {'class': 'my- form-class'} } ) }}
166
167
{{ form_widget(form) }}
167
- </form>
168
-
169
- .. best-practice ::
170
-
171
- Don't use the ``form() `` or ``form_start() `` functions to render the
172
- starting and ending form tags.
173
-
174
- Experienced Symfony developers will recognize that we're rendering the ``<form> ``
175
- tags manually instead of using the ``form_start() `` or ``form() `` functions.
176
- While those are convenient, they take away from some clarity with little
177
- benefit.
178
-
179
- .. tip ::
180
-
181
- The exception is a delete form because it's really just one button and
182
- so benefits from some of these extra shortcuts.
168
+ {{ form_end(form) }}
183
169
184
170
If you need more control over how your fields are rendered, then you should
185
171
remove the ``form_widget(form) `` function and render your fields individually.
You can’t perform that action at this time.
0 commit comments