F
Filament3mo ago
Abi

Updating Standalone Action's modal description based on the argument passed to the form

I have a standalone action that launches a modal. I want to update the modal description based on the argument passed to the Form?
Action::make('addToCart')
->label('ADD PLAYERS TO CART')
->modalDescription(new HtmlString('Some Description goes here.'))
->modalWidth('2xl')
->modalSubmitActionLabel('Add Player to Cart')
->modalFooterActionsAlignment('end')
->form(function ($arguments) {
// Update the Modal Description from here.
})
Action::make('addToCart')
->label('ADD PLAYERS TO CART')
->modalDescription(new HtmlString('Some Description goes here.'))
->modalWidth('2xl')
->modalSubmitActionLabel('Add Player to Cart')
->modalFooterActionsAlignment('end')
->form(function ($arguments) {
// Update the Modal Description from here.
})
5 Replies
toeknee
toeknee3mo ago
You can't really do that, you could have the description load a state value? defaulting to Some Description. And selecting a value is live which would cause the modal to refresh. Or you can use the placeholder field instead of description and set the value that way?
Abi
Abi3mo ago
so, there is no way to access the action object inside the form function ?
toeknee
toeknee3mo ago
Not as far as I am aware. You could try passing in $action within the function, but it hasn't been initiated yet so I double it.
Abi
Abi3mo ago
i do have the instance of the $action on the form closure, but setting the modalDescription doesn't take effect, not sure if I need to do something to re-render
toeknee
toeknee3mo ago
Did you set the form field as live?
Want results from more Discord servers?
Add your server
More Posts
Spark Billable Slug redirects to wrong urlI am using the Spark Billing Portal with Filament and everything is working so far, except the rediIs it possible to pre-populate this form with some data?I have a custom widget, with a heading defined like so: ```php <div class="flex items-center justifTrouble with Export/Import in Laravel Filament Admin Panel: 'Login Route Not Found' ErrorHi, I'm currently using the Laravel Filament admin panel for my application. I've been working on geHow can personalize the buttons style for Create, Delete, Cancel, SaveHey guys, i working and configuring a new theme in my project, i inspect the desing and can see the Getting Error in Sudden Change in TabI'm using a Custom table which is changing through a Year filter and I 'm getting Typed property FilHow do I filter data by permissionI have a table of Orders. So i have OrderResource but how do i filter the order based on type. For open modal on page loadI have a modal that has a trigger button and opens fine from the trigger button, but I also want to Delete Bulk ActionI have a table list that has delete bulk action (default), before I delete all data, I need to gathePassing another Model to an Action instead of that that the Table iterates throughI know what I've written sounds convoluted but what I basically want to achieve is this: I have a taPreventing Duplicate 'Active' Records in Model Using FilamentHello, I'm new to using filament, how can I prevent a new record in my SchoolDiar model from being w