TextInput get disabled state in placeholder callback?

How can I access the disabled state from the placeholder callback? To avoid repetition
TextInput::make('title')
->disabled(fn (Get $get) => someIntenseCalculation($get('someOtherField')))
->placeholder(fn ($getDisabledStateSomehow) => $getDisabledStateSomehow ? 'Field disabled' : 'Enter title')
TextInput::make('title')
->disabled(fn (Get $get) => someIntenseCalculation($get('someOtherField')))
->placeholder(fn ($getDisabledStateSomehow) => $getDisabledStateSomehow ? 'Field disabled' : 'Enter title')
2 Replies
Martin Lakrids
Martin LakridsOP8mo ago
I suppose i somehow can inject the "current field" like i could inject an instance of the entire livewire form component, however i just want to inject the current input
LeandroFerreira
LeandroFerreira8mo ago
->afterStateHydrated(function (TextInput $component) {
$component->placeholder('xxx');
$component->disabled();
})
->afterStateHydrated(function (TextInput $component) {
$component->placeholder('xxx');
$component->disabled();
})

Did you find this page helpful?