© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
13 replies
Barbaracrlp

Form Validation inside Action

Hi, I'm trying to add a simple form validation inside my 'delete action'.
I want to show a random number and the user to introduce the same to delete the record.
I've tried changing the modal view, but it justs keeps dee¡leting everything no matter the form: <
Tables\Actions\Action::make('Delete')
                ->label('Eliminar')
               
                    ->color('danger')
                    ->modalContent(fn (Pedido $record,): View => view(
                        'filament.actions.deletePedido',
                        ['record' => $record, 'aleatorio' => rand(1000, 9999)],
                    ))
                    ->modalSubmitActionLabel('Eliminar')
                    ->modalCancelActionLabel('Cancelar')
                    ->color('danger')
                    ->action(function (Pedido $record, Request $request) {
                        $userNum = $request->input('userNum');
                        error_log($userNum."el del susuario");
                       
                        $aleatorio = $request->input('aleatorio');
                        error_log($aleatorio."el del susuario");
                
                        if ($userNum === $aleatorio) {
                            error_log("Se borra");
                        }
                        else{
                            error_log(" No Se borra");
                        }
                    })>
Tables\Actions\Action::make('Delete')
                ->label('Eliminar')
               
                    ->color('danger')
                    ->modalContent(fn (Pedido $record,): View => view(
                        'filament.actions.deletePedido',
                        ['record' => $record, 'aleatorio' => rand(1000, 9999)],
                    ))
                    ->modalSubmitActionLabel('Eliminar')
                    ->modalCancelActionLabel('Cancelar')
                    ->color('danger')
                    ->action(function (Pedido $record, Request $request) {
                        $userNum = $request->input('userNum');
                        error_log($userNum."el del susuario");
                       
                        $aleatorio = $request->input('aleatorio');
                        error_log($aleatorio."el del susuario");
                
                        if ($userNum === $aleatorio) {
                            error_log("Se borra");
                        }
                        else{
                            error_log(" No Se borra");
                        }
                    })>
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Modal action or table inside form
FilamentFFilament / ❓┊help
2y ago
Change form validation on custom action click.
FilamentFFilament / ❓┊help
3y ago
Form validation
FilamentFFilament / ❓┊help
3y ago
Nested Actions, Parent Form validation
FilamentFFilament / ❓┊help
10mo ago