How can I make the action button in my form toggle the visibility of another section?
I've tried doing this but the visibility doesn't change.
private $showPreviousAddress = true;
...
Section::make('Person')
->schema([
TextInput::make('residentialaddress1')->label('Name'),
Actions::make([
Action::make('Show/Hide Details')
->action(function () {
$this->showHideDetails= !$this->showHideDetails;
})
]),
]),
Section::make('Person Details')
->visible($this->showHideDetails)
->schema([
TextInput::make('prevresidentialaddress1')->label('Address Line 1'),
TextInput::make('prevresidentialpostcode')->label('Postcode')
]),
private $showPreviousAddress = true;
...
Section::make('Person')
->schema([
TextInput::make('residentialaddress1')->label('Name'),
Actions::make([
Action::make('Show/Hide Details')
->action(function () {
$this->showHideDetails= !$this->showHideDetails;
})
]),
]),
Section::make('Person Details')
->visible($this->showHideDetails)
->schema([
TextInput::make('prevresidentialaddress1')->label('Address Line 1'),
TextInput::make('prevresidentialpostcode')->label('Postcode')
]),