Reset form data in action
I've got an action with a form, within that action i've got another action, with that action i want to reset the form data but it doesnt seem to do anything.
protected function setUp(): void {
parent::setUp();
$this->modalCancelAction(false)
->modalSubmitAction(false)
->extraModalFooterActions([
Action::make('next')
->action(function($record){
$this->resetFormData();
})
]);
$this->mountUsing(function (ComponentContainer $form, ManufacturingOrder $order){
$form->fill([
'status' => $order->status,
]);
});
$this->form([
Select::make('status')->options([
'open' => 'Open',
'finished' => 'Finished',
})->afterStateUpdated(function ($record, $state) {
$record->update(['status' => $state])
})->reactive()
])
->action(function($data, $record){
dd($data, $record);
});
}protected function setUp(): void {
parent::setUp();
$this->modalCancelAction(false)
->modalSubmitAction(false)
->extraModalFooterActions([
Action::make('next')
->action(function($record){
$this->resetFormData();
})
]);
$this->mountUsing(function (ComponentContainer $form, ManufacturingOrder $order){
$form->fill([
'status' => $order->status,
]);
});
$this->form([
Select::make('status')->options([
'open' => 'Open',
'finished' => 'Finished',
})->afterStateUpdated(function ($record, $state) {
$record->update(['status' => $state])
})->reactive()
])
->action(function($data, $record){
dd($data, $record);
});
}