how to perform some stuff before dispatching an event in action

public function clearAction(): Action { return Action::make('clear') ->size(ActionSize::Large) ->dispatch('clear-form'); } this action is clearing localstorage but i also want to clear form data along with this, for that i want to do this $this->form->fill(); can anyone please help me where i should use this ?
2 Replies
David Vincent
David Vincent9mo ago
did you try ->action() and call $this->form->fill(); and $this->dispatch in it ?
akash sagar
akash sagarOP9mo ago
hi @David Vincent , thanks for replying i have not tried what you have recommended instead i am doing this #[On('clear-form')] public function clearFormFileds() { $this->form->fill(); } i have generated event listener and put that $this->form->fill(); inside and it is working fine, can you please let me know is it correct way or is it good practice ?

Did you find this page helpful?