Created
March 21, 2015 10:45
-
-
Save wouterj/8791c196e787f822d573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$form = $formBuilder | |
// ... add the fields | |
->add('delete', 'submit') // add delete button | |
->add('save', 'submit') // add save button | |
->getForm(); | |
$form->handleRequest($request); | |
// do not check if form is valid yet | |
if ($form->isSubmitted()) { | |
if ($form->get('delete')->isClicked) { | |
// item needs to be deleted | |
return; | |
} elseif ($form->isValid()) { | |
// item is valid and needs to be updated | |
// ... | |
} | |
} | |
return $this->render(/* ... render the form */); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment