Using a Wizard inside a relationManager?

Hi, I'm trying to use a form wizard inside the form method but not sure if that can be done ?
Solution:
So my first thought would be to try using the Wizard as a layout component, inside of your working form: https://filamentphp.com/docs/3.x/forms/layout/wizard...
Jump to solution
45 Replies
Patrick Boivin
Patrick Boivin16mo ago
Can you share your code?
ingmontoya
ingmontoyaOP16mo ago
No description
ingmontoya
ingmontoyaOP16mo ago
had to remove the Wizard code because it wasn't working at all
ingmontoya
ingmontoyaOP16mo ago
ingmontoya
ingmontoyaOP16mo ago
so, the form that pops up in the modal, it's going to be growing, that's why I need wizard...
ingmontoya
ingmontoyaOP16mo ago
added this code to the table function but it's not working either
No description
ingmontoya
ingmontoyaOP16mo ago
and now I'm getting this error when opens the modal
No description
Patrick Boivin
Patrick Boivin16mo ago
It's missing the doctor id somehow. Sorry it's hard to help with screenshots. If you could share the code as text.
ingmontoya
ingmontoyaOP16mo ago
but only happens when trying to implement the wizard without wizzard works just fine
ingmontoya
ingmontoyaOP16mo ago
this is the whole code
Patrick Boivin
Patrick Boivin16mo ago
Ok I see a steps() method with the Wizard, but I don't see how it's used in the form
awcodes
awcodes16mo ago
Crazy thought, try naming your action to something other than ‘create’ And Patrick is right, where’s the doctor_id in your wizard?
ingmontoya
ingmontoyaOP16mo ago
so, that wizard is just the example posted in the fillament page That’s what’s not clear to me how to use it 😐
Patrick Boivin
Patrick Boivin16mo ago
Just to make sure I understand: What is your final goal? Do you want to organize the form fields with a Wizard, inside of the Create action of the relation manager?
ingmontoya
ingmontoyaOP16mo ago
Correct
Patrick Boivin
Patrick Boivin16mo ago
And what's the current version of your code? I see above you have a custom header action where you're calling ->steps(), and then the code you shared for the relation manager, which has both a form() and a steps() method. What is working for you at this point?
ingmontoya
ingmontoyaOP16mo ago
it only works the form method (commented code) bc I haven't been able to make the wizzard work in that relation manager
Patrick Boivin
Patrick Boivin16mo ago
Ok, so you have a version of the Create action with a regular form, that saves correctly?
ingmontoya
ingmontoyaOP16mo ago
yes, works perfect... I wanted to add the wizard becase the content it's too large and it's gonna be working with steps
Patrick Boivin
Patrick Boivin16mo ago
Ok, sounds good.
Solution
Patrick Boivin
Patrick Boivin16mo ago
So my first thought would be to try using the Wizard as a layout component, inside of your working form: https://filamentphp.com/docs/3.x/forms/layout/wizard
Patrick Boivin
Patrick Boivin16mo ago
Does that make sense?
ingmontoya
ingmontoyaOP16mo ago
that worked
No description
Patrick Boivin
Patrick Boivin16mo ago
Very nice
ingmontoya
ingmontoyaOP16mo ago
Patrick Boivin
Patrick Boivin16mo ago
Just a thought - You can also remove the modal actions at the bottom and add a submit button on the last step of the Wizard, to make sure users have to go through all the steps:
CreateAction::make()
->modalFooterActions(fn () => [])
CreateAction::make()
->modalFooterActions(fn () => [])
ingmontoya
ingmontoyaOP16mo ago
awesome, thank you so much my man! it doesn't hide the footer buttons ->headerActions([ Tables\Actions\CreateAction::make()->modalFooterActions(fn () => null), ]) or ->headerActions([ Tables\Actions\CreateAction::make()->modalFooterActions(fn () => []), ]) I alos use ->modalSubmitAction(false)
Patrick Boivin
Patrick Boivin16mo ago
Hmm... not sure, this one works for me fn () => []
ingmontoya
ingmontoyaOP16mo ago
you add that code un the CreateAction::make() ? it's a relation manager view?
Patrick Boivin
Patrick Boivin16mo ago
I'll do one more test Yes, just like that on the relation manager table:
->headerActions([
Tables\Actions\CreateAction::make()
->modalFooterActions(fn () => []),
])
->headerActions([
Tables\Actions\CreateAction::make()
->modalFooterActions(fn () => []),
])
ingmontoya
ingmontoyaOP16mo ago
No description
ingmontoya
ingmontoyaOP16mo ago
exactly like I have the code..it's weird
Patrick Boivin
Patrick Boivin16mo ago
Try this:
Tables\Actions\Action::make('test')
->form([ TextInput::make('test') ])
->modalFooterActions(fn () => []),
Tables\Actions\Action::make('test')
->form([ TextInput::make('test') ])
->modalFooterActions(fn () => []),
Does it work on a custom action?
ingmontoya
ingmontoyaOP16mo ago
yes, it works in a custom action
ingmontoya
ingmontoyaOP16mo ago
No description
Patrick Boivin
Patrick Boivin16mo ago
Mkay, I really don't know at this point 😅
ingmontoya
ingmontoyaOP16mo ago
oh I know just passed the name of the method to the CreateAction:make and that makes it work LOL ->headerActions([ Tables\Actions\CreateAction::make('form') ->modalFooterActions(fn () => []), ])
Patrick Boivin
Patrick Boivin16mo ago
Oooh! Nice, good to know. Very weird... but if it works it works 😁
ingmontoya
ingmontoyaOP16mo ago
LOL thanks!
shojibflamon
shojibflamon15mo ago
How to make each step submit button in filament wizard so that I can save two table data from one wizard.
ingmontoya
ingmontoyaOP15mo ago
to save in two different tables you have to use ->relationship()
shojibflamon
shojibflamon14mo ago
Its actually one to one relationship. So first time its create with related table and later always update LIke Creating customer & later will create customer profile & finally always update profile.

Did you find this page helpful?