Showing a success message after form validation and before submission

Hi guys, consider this field:

Forms\Components\TextInput::make('name')
                    ->required()
                    ->maxLength(255)
                    ->helperText(new HtmlString("The name you choose here will be the name used to set up your repository, e.g. https://github.com/company/<strong>name</strong>.git."))
                    ->default(function($state, $livewire) {
                        return RepositoryService::createDefaultRepositoryName($livewire->ownerRecord->name);
                    } )
                    ->live()
                    ->unique(ignoreRecord: true)
                    ->rules([
                        fn (Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
                            if ($get('type') === 'github' && GithubService::create()->repoExists($value)) {
                                $fail("This repository already exists!");
                            }
                        }
                        ])
                    ->afterStateUpdated(function (Forms\Contracts\HasForms $livewire, Forms\Components\TextInput $component) {
                        $livewire->validateOnly($component->getStatePath());
                    })


This succesfully shows an error message if the repository already exists, but I'd also like to show a green message if the repo name is ok! Also, bonus points if someone knows how to add some sort of spinner to the form while it's off doing its validation...
Was this page helpful?