Access form with extra modal footer
I'd like to access the form data with $get in an extra footer action
Solution:Jump to solution
https://filamentphp.com/docs/3.x/forms/actions
I've found this, I'm going to move the footer actions into the form...
31 Replies
this throws "Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization".. which somewhat makes sense since I guess the extra footer action is not inside the actual form
is there another way I can get live data from the form to toggle my extra action's visibilty?
maybe injecting $livewire and using
$livewire->mountedActionsData
🤔This is an empty array and doesnt seem to get filled
I guess
hidden()
is ran before the action is mounted?I think so
I'll just have them save and revisit the modal then I guess
I don't know what you are trying to do, but I think if
form_input
is live, this will work when you change the field value..the input is live, it doesnt work though,
this never dumps, I guess because
hidden
is not ran again to re check visbility since the action is not inside the form 🤔
live just tells the form to reload.. so I'm assuming the action isnt inside of the form
Let me clarify then, I have some inputs inside of a modal (table action)
I have some extraModalFooterActions()
, that I want to be visible depending on the state of some of the inputs in the modal
I can get around this by having the user save first and then just accessing $record.. but it requires them to click 2 times.. which is a bit annoyingIt should be reachable via
$livewire->form
how do I access input values from here?
Huh, I might have mixed a place. Buut, it's possible to get to the action via:
In my case, this gets to action form data, but it is not really reactive:
But this might be a direction 😅
I'm unsure if that would be reactive to the live input though
I'd assume not
Okay, it seems that the
->hidden()
runs once for each row and doesn't get called again
unless you have it somewhere else, not in a table row?Solution
https://filamentphp.com/docs/3.x/forms/actions
I've found this, I'm going to move the footer actions into the form
which will resolve the issue since it would be reloaded by the
->live()
method
Thanks for the effort :)No worries! Sad that couldn't help, but was interesting brain itch 😄
well it somewhat makes sense.. I just assumed the buttons/actions are inside the form which they apparently are not
wait, but how does the submit button then get handled?
maybe reverse-engineering that?
Or actually.. what if you trigger an event? Wouldn't that work...?
livewire emit I suppose?
The field that you depend on (the status in this case) needs to be set to live(), which tells the form to reload the schema each time it gets changed.and I guess -
>live()
just emits specifically the the components inside the schema array
but I'm just guessing hereMight be, but you could also emit something else via:
->afterStateUpdated($callback)
In that case, you could try to listen for that event on action
but that's a wild guess 😄time to go the the casino since we're just gambling :P
honestly, that is one of the reasons why I find some interesting use-cases for Filament 😄 It always starts with
what if...?
for menow I need to figure out how to call the submit button
:kekw:
this one for sure should be available via $livewire
probably something like
$livewire->call(..)
sorry for the delay.. following your code, if you are using a table action, I think it should be
$livewire->callMountedTableAction()
no worries, already fixed by moving the actions into the form so they update following
->live()
https://discord.com/channels/883083792112300104/1333748055585067131/1333768518864474134it makes sense 👍
throws
call()
doesnt exists on the page instance
tried the dirty aproach straight from v2 but this doesnt work either (sadge)
is it a table action?
its complicated 😂
its a Filament\Forms\Components\Actions\Action
inside of a the Form of a \Filament\Tables\Actions\Action
try
$livewire->callMountedTableAction()
to submit the formit does close the modal but doesnt save the data to db.. weird
nvm im stupid, hadnt defined said action yet
Thanks alot @LeandroFerreira !