Hide Text Form Input based on Selected Data from other Form Components

Hi there I have this codes, and I can't seem to make the expected hidden form behavior. The the other_information text input should show based on the data of the status Radio. Radio::make('status') ->options([ 0 => 'Open', 1 => 'Closed', 2 => 'Done', ]) ->default(0) ->required(), TextInput::make('other_information') ->numeric() ->visible(fn ($get) => $get('./status') < 1), Does anyone know how to do this? Thanks a bunch.
4 Replies
cheesegrits
cheesegrits15mo ago
Try adding live() to the 'status'. Also you don't really need the ./, just $get('status').
Mike Wazowski
Mike WazowskiOP15mo ago
Okay, Thank you. Trying it now Thank you @cheesegrits , it seems live() was the missing piece. Thank you!
cheesegrits
cheesegrits15mo ago
N/p. Basically, any time you need to run logic in your schema when a field is changed, it needs to be live(). That's the only way Livewire then knows to update, and your schema code gets re-run.
Mike Wazowski
Mike WazowskiOP15mo ago
Okay, I'll take note of this one. Thanks a bunch!
Want results from more Discord servers?
Add your server