Halt process in TextInputColumn beforeStateUpdate callback

Is there anyway I can halt update process in TextInputColumn?
4 Replies
pabbec
pabbec2mo ago
same problem, but with Select column, do you resolve this?
toeknee
toeknee2mo ago
can you provide a scenario why you want to halt?
Tally
Tally2mo ago
Maybe you have to use the updateStateUsing I don't see any reference in the code to halt or cancel the process
toeknee
toeknee2mo ago
You can use beforeStateUpdated Very rough quick
Tables\Columns\TextInputColumn::make('test')
->beforeStateUpdated(function ($record, $state) {
if ($state === 'test') {

Notification::make()
->title('Failed to update')
->danger()
->body('This is a test notification.')
->send();

throw ValidationException::withMessages([
'test' => 'This is a test error message.',
]);

}
}),
Tables\Columns\TextInputColumn::make('test')
->beforeStateUpdated(function ($record, $state) {
if ($state === 'test') {

Notification::make()
->title('Failed to update')
->danger()
->body('This is a test notification.')
->send();

throw ValidationException::withMessages([
'test' => 'This is a test error message.',
]);

}
}),
will clear the inputs and send a failure notification if the value = test.