modal form passing value from the action
In my view I have the following action:
this work pretty well, and I'm able to fetch my data from fillForm on the component:
but I need to pre-fetch some options (extracting them from database) using the same $arguments['member_id']. So something like this, but here the $arguments is not available
Any clue on how to archive that?
Thank you
Solution:Jump to solution
try only this
```php
return Actions\Action::make('subscribeMember')
->mountUsing(function (Form $form, array $arguments) {...
12 Replies
try
removed my previous answer because obviously wrong, by the way at that time, also with your example i'm not able to populate my radio on modal start...still trying...
probably found. The form that i'm using is a step (wizard), so my guess is that
$form->getStatePath().'.member_certificates'
isn't getting correctly my fieldshare the whole code on gist
https://gist.github.com/barianiluca/22849db816cd0a65c65064c200b35dc5
thank you
for now workarounded saving the member_id on the session, but not quite sure that is the best approach. imho the step/wizard form require a different mountUsing, but didn't find something on the docs
where are you using this action?
livewire component, called like:
{{ ($this->subscribeMemberAction)(['member_id' => $member->id]) }}
Does dd show the member_id?
Did you try static values like
Does it work?
hide other steps and try only
Documents
yep, the dd($arguments) works, but I need to comment the fillForm followed (but this is fine, i found this also in the doc).
The static options doesn't work too. But this morning i have tried to comment everything from my stepper form, and create an example with the simple form like your own example, and it worked.
It's for that, that my guess are that this
$form->getComponent($form->getStatePath() . '.member_certificates')
can't grab the correct input on the Documents step
yes also trying to comment everything, aside Documents didn't worksSolution
try only this
uh, this worked :squint:
I think you can add step by step and see where is the issue... But I think you can achieve what you want using
mountUsing
as I mentionedok i'll try in my way, thank you very muck for your extensive support on this. much appreciate