F
Filament11mo ago
Abi

Code Execution after successful validation for standalone forms and actions

for a standalone form, will all code after $this->form->getState() only be executed after all validations are passed? And is the same true for the standalone actions? Will the action() method only be triggered after all the validations of the form are passed?
5 Replies
LeandroFerreira
LeandroFerreira11mo ago
what is the issue?
Abi
Abi11mo ago
I need to run a DB operations but only want to do it after all the validations have passed. Just want to make sure of that
LeandroFerreira
LeandroFerreira11mo ago
$data = $this->form->getState();

//DB operations..
$data = $this->form->getState();

//DB operations..
Abi
Abi11mo ago
ya, I just wanted to confirm that is the case, I am doing this only... thank you for confirming appreciate if you could also take a look at this question https://discord.com/channels/883083792112300104/1146130121045049445
cheesegrits
cheesegrits11mo ago
"you can validate and get the form's data using $this->form->getState(). It's important that you use this method instead of accessing the $this->data property directly, because the form's data needs to be validated and transformed into a useful format before being returned" https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component/#adding-the-form
Want results from more Discord servers?
Add your server
More Posts