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
Can you share your code?
ingmontoya
ingmontoyaOP2y ago
No description
ingmontoya
ingmontoyaOP2y ago
had to remove the Wizard code because it wasn't working at all
ingmontoya
ingmontoyaOP2y ago
ingmontoya
ingmontoyaOP2y ago
so, the form that pops up in the modal, it's going to be growing, that's why I need wizard...
ingmontoya
ingmontoyaOP2y ago
added this code to the table function but it's not working either
No description
ingmontoya
ingmontoyaOP2y ago
and now I'm getting this error when opens the modal
No description
Patrick Boivin
It's missing the doctor id somehow. Sorry it's hard to help with screenshots. If you could share the code as text.
ingmontoya
ingmontoyaOP2y ago
but only happens when trying to implement the wizard without wizzard works just fine
ingmontoya
ingmontoyaOP2y ago
this is the whole code
Patrick Boivin
Ok I see a steps() method with the Wizard, but I don't see how it's used in the form
awcodes
awcodes2y 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
ingmontoyaOP2y 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
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
ingmontoyaOP2y ago
Correct
Patrick Boivin
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
ingmontoyaOP2y 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
Ok, so you have a version of the Create action with a regular form, that saves correctly?
ingmontoya
ingmontoyaOP2y 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
Ok, sounds good.
Solution
Patrick Boivin
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
Does that make sense?
ingmontoya
ingmontoyaOP2y ago
that worked
No description
Patrick Boivin
Very nice
ingmontoya
ingmontoyaOP2y ago
Patrick Boivin
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
ingmontoyaOP2y 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
Hmm... not sure, this one works for me fn () => []
ingmontoya
ingmontoyaOP2y ago
you add that code un the CreateAction::make() ? it's a relation manager view?
Patrick Boivin
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
ingmontoyaOP2y ago
No description
ingmontoya
ingmontoyaOP2y ago
exactly like I have the code..it's weird
Patrick Boivin
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
ingmontoyaOP2y ago
yes, it works in a custom action
ingmontoya
ingmontoyaOP2y ago
No description
Patrick Boivin
Mkay, I really don't know at this point 😅
ingmontoya
ingmontoyaOP2y 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
Oooh! Nice, good to know. Very weird... but if it works it works 😁
ingmontoya
ingmontoyaOP2y ago
LOL thanks!
shojibflamon
shojibflamon17mo ago
How to make each step submit button in filament wizard so that I can save two table data from one wizard.
ingmontoya
ingmontoyaOP17mo ago
to save in two different tables you have to use ->relationship()
shojibflamon
shojibflamon16mo 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?