How to trigger a click event on 'next' button click in Wizard Step form.

I am using Action on table. Inside the Action I am using Wizard Steps. In my first Step using a Livewire component to create table like form. Now by default I have 'Next' in Step 1 to goto in Step 2. I would like to trigger a click event on click of this button Next button. Any idea please help.
Wizard::make()
->steps([
Step::make('Select Channels')
->schema([
TextInput::make('search')
->label('Search Channels')
->placeholder('Search channels...')
->reactive()
->afterStateUpdated(function ($state, $get, $set) {
$set('search', $state);
}),

Forms\Components\View::make('livewire-channel-table')
->afterStateUpdated(function ($state, $get, $set) {
$set('selectedChannels', $state['selectedChannels'] ?? []);
})
->extraAttributes(['wire:ignore' => true]),
]),

Step::make('Another Step')
// More code continued...
Wizard::make()
->steps([
Step::make('Select Channels')
->schema([
TextInput::make('search')
->label('Search Channels')
->placeholder('Search channels...')
->reactive()
->afterStateUpdated(function ($state, $get, $set) {
$set('search', $state);
}),

Forms\Components\View::make('livewire-channel-table')
->afterStateUpdated(function ($state, $get, $set) {
$set('selectedChannels', $state['selectedChannels'] ?? []);
})
->extraAttributes(['wire:ignore' => true]),
]),

Step::make('Another Step')
// More code continued...
No description
4 Replies
Sujay Barma
Sujay BarmaOP5mo ago
Thank you 🙏 now I am using this
->nextAction(
fn (Forms\Components\Actions\Action $action) => $action->label('Next step'),
)
->nextAction(
fn (Forms\Components\Actions\Action $action) => $action->label('Next step'),
)
could you please guide me on how a click event here.
Arghyaashu
Arghyaashu5mo ago
Just dispatch any event from nextAction, when the next button is clicked it will work
Sujay Barma
Sujay BarmaOP5mo ago
ok

Did you find this page helpful?