Get Current Step on Wizard

Hi guys, im so confused how to get current step on wizard nextAction, is there have a solution? for example if current step is on Delivery, i wanna disabled next button after validation has clear. Thank you
No description
6 Replies
Mauricio G
Mauricio G8mo ago
I also need it, and I couldn't get it, did you happen to get it?
toeknee
toeknee8mo ago
You can't go to next unless validation has passed, so why disable it?
neverything
neverything8mo ago
Haven't used the Wizard yet, but if you can turn on the persistStepInQueryString you should be able to get the current step using request()->query($this->getStepQueryStringKey()) Have a look at https://github.com/filamentphp/filament/blob/fe0cdd1ef29f3ea09fcff96af9f0e82b7e9bab70/packages/forms/src/Components/Wizard.php#L218-L233, maybe there is a simpler way.
GitHub
filament/packages/forms/src/Components/Wizard.php at fe0cdd1ef29f3e...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
zydnrbrn
zydnrbrnOP7mo ago
Now the application development period is complete sir 😅 , and yeah im use validation for solving my problems i think the tricks that say on the top worth to try
Mauricio G
Mauricio G7mo ago
Thanks Thanks
ingeday
ingeday4w ago
Hello, I hope you are doing great today! I was reading this topic and I have a question. In my scenario I have a Wizard inside a page.
protected function getFormSchema(): array
{


return [
Forms\Components\Wizard::make([
// Step 1: Importar archivo
Forms\Components\Wizard\Step::make('Importar Archivo')
->schema([
Forms\Components\FileUpload::make('csv_file')
->afterStateUpdated(function ($state, $set) {
if ($state) {
$this->verifyIntegrity($state, $set);
}
})
]),

// Step 2: Verificar integridad
Forms\Components\Wizard\Step::make('Verificar Integridad')
->schema([
Grid::make(1) // Una sola columna
->schema(function ($get, $set) {

// NOTE: Here in step 2, I show the value of the step variable received by GET, but it is evaluated only in the first request, that is, when step 1 loads, when I go to step 2 it returns NULL.
dd(request()->query('step'));

// Here I want to evaluate with an IF...ELSE request()->query('step')

return [];
})
]),
protected function getFormSchema(): array
{


return [
Forms\Components\Wizard::make([
// Step 1: Importar archivo
Forms\Components\Wizard\Step::make('Importar Archivo')
->schema([
Forms\Components\FileUpload::make('csv_file')
->afterStateUpdated(function ($state, $set) {
if ($state) {
$this->verifyIntegrity($state, $set);
}
})
]),

// Step 2: Verificar integridad
Forms\Components\Wizard\Step::make('Verificar Integridad')
->schema([
Grid::make(1) // Una sola columna
->schema(function ($get, $set) {

// NOTE: Here in step 2, I show the value of the step variable received by GET, but it is evaluated only in the first request, that is, when step 1 loads, when I go to step 2 it returns NULL.
dd(request()->query('step'));

// Here I want to evaluate with an IF...ELSE request()->query('step')

return [];
})
]),
Any idea to get correctly the current step in every steps ? Thanks a lot.

Did you find this page helpful?