How to correctly redraw form snippet after AJAX submit (fixed)
Notice: This thread is very old.
- mskocik
- Member | 61
Hi, I have a component consisting of 2 snippets:
- data table
- insert/edit form (control form in template)
When I insert new record, the form snippet is redrawn with values previously submitted. How can I avoid that? I want empty form after submit.
class ExerciseEditor extends UI\Control
...
public function createComponentForm()
{
$form = $this->factory->create();
$form->onSuccess[] = [$this, 'processEditorForm'];
return $form;
}
public function processEditorForm($form, $values)
{
//process form...
$this->redrawControl('listArea');
$this->redrawControl('formArea'); // how to redraw empty form? It redraws with submitted values
//NON-ajax workaroud
$this->redirect('this');
}
Is redirecting the only solution?
Last edited by mskocik (2016-08-16 10:07)