Reputation: 385
I wonder whether there is a simple way to reset one of the form fields after form submission and then pass the form to the view - to render the same form but one of the field will be with it's default value. Something like:
$form = $this->createForm('MyForm');
$form->handleRequest($request);
if ($form->isValid()) {
// do something
// ...
// reset one of the form field to it's default value
// something like:
// $form->field->reset() or
// $form->field->setValue('');
}
return array(
'form' => $form->createView(),
);
Thanks!
Upvotes: 2
Views: 1948