File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,30 @@ _also_ changes the redirect status code from 302 (the default) to 303
155155(`HTTP_SEE_OTHER`). That's not required for Turbo Drive, but 303 is "more correct"
156156for this situation.
157157
158+ > **NOTE:**
159+ > When your form contains more than one submit button and, you want to check which of the buttons was clicked
160+ > to adapt the program flow in your controller. You need to add a value to each button because
161+ > Turbo Drive doesn't send element with empty value:
162+
163+ ` ` ` php
164+ $form = $this->createFormBuilder($task)
165+ ->add('task', TextType::class)
166+ ->add('dueDate', DateType::class)
167+ ->add('save', SubmitType::class, [
168+ 'label' => 'Create Task',
169+ 'attr' => [
170+ 'value' => 'create-task'
171+ ]
172+ ])
173+ ->add('saveAndAdd', SubmitType::class, [
174+ 'label' => 'Save and Add',
175+ 'attr' => [
176+ 'value' => 'save-and-add'
177+ ]
178+ ])
179+ ->getForm();
180+ ` ` `
181+
158182# ### More Turbo Drive Info
159183
160184[Read the Turbo Drive documentation](https://turbo.hotwire.dev/handbook/drive) to learn about the advanced features offered
You can’t perform that action at this time.
0 commit comments