Disable dependend fields

Hi, i have two text fields:
Forms\Components\TextInput::make('field1')->reactive(),
Forms\Components\TextInput::make('field2')->disabled(fn(callable $get) => $get('field1') === '')
Forms\Components\TextInput::make('field1')->reactive(),
Forms\Components\TextInput::make('field2')->disabled(fn(callable $get) => $get('field1') === '')
I'm trying to disable the field2 when field1 is empty. How can I access with $get() to the field1 value?
3 Replies
Dan Harrin
Dan Harrin2y ago
you did it right maybe you also need to account for a null value
jals65
jals65OP2y ago
Thanks, that works. I don't know why with '' empty string doesn't works, but with null works well.
Dan Harrin
Dan Harrin2y ago
->disabled(fn(callable $get) => blank($get('field1')))
Want results from more Discord servers?
Add your server