Update form field from page action
Hi all, I feel like this is relatively simple Livewire stuff but I can't figure it out. I'm trying to dynamically update a field from a page action in my
EditRecord
class, I've tried a few different things without any luck :
Am I getting warmer?7 Replies
I've also added
->reactive()
to my field definitionFilament
Actions - Pages - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Thanks for the super quick reply @Leandro Ferreira! So if I understand correctly, this would imply updating the record in the DB, then refreshing the form?
yes
Ok great. What's different in my case is I'm trying to update the form field, without updating the record. I still want to wait for an explicit "save" action from the user.
just use refreshFormData
I see! I'll give this a try.
None of these seem to work for me :
Although when I refresh the page after C, my field has the updated value (obviously...). What am I missing?
Ok so after a bit more debugging, this seems to work :
but my problem is that my
->formatStateUsing()
logic in my field doesn't seem to be applied to the new updated value.
Gaaah, turns out this is doing exactly what I want :
But in my context, the value needed to be a string to be properly handled. Thanks again @Leandro Ferreira.