Wizard, stop from going to next step within `beforeValidation` or `afterValidation`

Hi, looking to create a modal on a panel-custom-page whereas on a step within a wizard, triggers a few API calls on the Livewire component and I would like to have the user wait until they finish/fail and if they fail; keep them on the current step to retry.
1 Reply
Prymiee
Prymiee5mo ago
// Not sure afterValidation is correct here but, would like to ensure the inputs are validated before sending the API calls
Step::make('Payment Processing')->afterValidation(function () {
// Make an API call
// Determine if the inputs were valid
// If they are NOT valid, popup a modal (like `$this->dispatch('open-modal', id: 'invalid-token')`) and do not progress to the next step.
})->schema([
TextInput::make('access_token')->required(),
]),
// Not sure afterValidation is correct here but, would like to ensure the inputs are validated before sending the API calls
Step::make('Payment Processing')->afterValidation(function () {
// Make an API call
// Determine if the inputs were valid
// If they are NOT valid, popup a modal (like `$this->dispatch('open-modal', id: 'invalid-token')`) and do not progress to the next step.
})->schema([
TextInput::make('access_token')->required(),
]),
Am I wildly off-base for setting up a way to interact and validate user input semi-realtime via another source?