F
Filament2mo ago
James

Don't dehydrate hidden field in Repeater

I have a Repeater field that has a selection for languages. When the selected language is English, I'd like to show some fields, hiding those fields for any other language selection. Issue is that when my form is saved, the hidden fields are populated with null values. How do I avoid this? I don't need them saved.
4 Replies
Mohamed Ayaou
Mohamed Ayaou2mo ago
use ->dehydrated(false) for any field you want to be ignored by the save process it accepts also a closure
James
JamesOP2mo ago
I tried this but it didn't work. I still get null values committed to the DB. PS: The Repeater saves in a JSON field. @Mohamed Ayaou
Mohamed Ayaou
Mohamed Ayaou2mo ago
I think the values will be svaed as null if the key is presented, I think you have to unset the keys as well

Did you find this page helpful?