show/hide field depending on data load?

I'm trying to show a Repeater based on a Radio field, it's working fine but the problem is not working on first load, see video attached. I'm using live(), also tried with reactive() none of those works to get the data onload
Solution:
intval($get('has_additionals')) === 1 ?...
Jump to solution
4 Replies
Homd
Homd13mo ago
Share some code
ingmontoya
ingmontoyaOP13mo ago
Radio::make('has_additionals')
->label('hasAdditionals')
->translateLabel()
->live()
->options([
'1' => 'Si',
'0' => 'No'
])->columns(2),
Repeater::make('additional')
->label('addAdditionalServices')
->translateLabel()
->visible(fn (Get $get): bool => $get('has_additionals') === '1')
->schema([
TextInput::make('name')
->translateLabel()
->required(),
TextInput::make('value')
->translateLabel()
->numeric()
->required()
])
Radio::make('has_additionals')
->label('hasAdditionals')
->translateLabel()
->live()
->options([
'1' => 'Si',
'0' => 'No'
])->columns(2),
Repeater::make('additional')
->label('addAdditionalServices')
->translateLabel()
->visible(fn (Get $get): bool => $get('has_additionals') === '1')
->schema([
TextInput::make('name')
->translateLabel()
->required(),
TextInput::make('value')
->translateLabel()
->numeric()
->required()
])
Solution
LeandroFerreira
LeandroFerreira13mo ago
intval($get('has_additionals')) === 1 ?
ingmontoya
ingmontoyaOP13mo ago
didn't work my bad, it works! thank you!
Want results from more Discord servers?
Add your server