F
Filamentβ€’17mo ago
ralphredd

Disable form field if it has value

Hello, is there a way to disable form field on edit page if for example it is not empty or it has a certain value. I'm trying to use a disabled function but I'm not sure how to get the model values into the condition. Any help appreciated!
5 Replies
Yuut4
Yuut4β€’17mo ago
->disable(function ($state) {
if ($state = null) {
#your logic
}
#rest of your logic
})
->disable(function ($state) {
if ($state = null) {
#your logic
}
#rest of your logic
})
I think this works or not now I'm in debt doubt*
ralphredd
ralphreddOPβ€’17mo ago
I'm still om version 2 so first solution - not there yet πŸ™‚ Livewire 3 messes up my other stuff
Dennis Koch
Dennis Kochβ€’17mo ago
->disable(fn ($state) => filled($state)) It's the same for v2 πŸ˜‰ At the least the concept is the same.
ralphredd
ralphreddOPβ€’17mo ago
The last suggestion worked! Thank you so much. I've been only playing with Filament for 2 days.
Want results from more Discord servers?
Add your server