Value not updated when clicking save
I have a column called
videos_id
in my table. And a videos table where that ID is the primary key id
and a column called title
. In this dropdown on the Filament Edit page I want to show the title and not the ID. So I am doing this:
Which works fine. But when I change the value and click Save. The old ID is still present on the row.
Devtools show a POST request to /livewire/update
with JSON data which does contain the NEW id. So I am puzzled why this happens.
Removed all the other data from the JSON to make it readable.Solution:Jump to solution
You should never have fields with the same name/ID. Give it a different name and use
getStateUsing()
3 Replies
Ah I figured out why. I also have a disabled field showing the videos_id itself. It changes live when picking a new value from the dropdown but for some reason it makes the update fail. When I remove this field it works fine.
Anny way to make this work?
Since it's not dehydrated I figured it would work as its not being sent to the server. In the JSON above there is only one videos_id being sent, and its the right one (the new value).
Solution
You should never have fields with the same name/ID. Give it a different name and use
getStateUsing()
Cheers!