repeater checkbox problem

want only select one checkbox in repeter form how can i handle
No description
14 Replies
waqar
waqarOP2y ago
hello any one available ?
toeknee
toeknee2y ago
So I would simply do:|
->afterStateUpdated(fn($state, $set) => $state ? $set('other_tickbox', false))
->afterStateUpdated(fn($state, $set) => $state ? $set('other_tickbox', false))
basically, if state is ticked, untick the other
waqar
waqarOP2y ago
doest not work this solution this solution is all over checkbox uncheck when i call state the only current index pick i want to only current checked and other is false
toeknee
toeknee2y ago
Ok we need to see your code how you have built the above for us to understand it.
waqar
waqarOP2y ago
No description
waqar
waqarOP2y ago
actully when afterStateUpdated trigred he only get current state get not get other
toeknee
toeknee2y ago
Ugh that's a mess, you are setting the one thats updated
waqar
waqarOP2y ago
yeah it pick only current state
toeknee
toeknee2y ago
Add to uol
->afterStateUpdated(function($state, $set) {
if((bool) $state) {
$set('col', false);

})
->afterStateUpdated(function($state, $set) {
if((bool) $state) {
$set('col', false);

})
add to col
->afterStateUpdated(function($state, $set) {
if((bool) $state) {
$set('uol', false);

})
->afterStateUpdated(function($state, $set) {
if((bool) $state) {
$set('uol', false);

})
waqar
waqarOP2y ago
ok when i click on checkbox cliecked chekcbox unchecked and not impect other checkbox
toeknee
toeknee2y ago
You need to add ->reactive() to the checkboxes...
waqar
waqarOP2y ago
i have add live() now will remove live() and replace reactive()
toeknee
toeknee2y ago
tested working on V2
Checkbox::make('col')
->reactive()
->afterStateUpdated(function($state, $set) {
$set('uol', false);
}),
Checkbox::make('uol')
->reactive()
->afterStateUpdated(function($state, $set) {
$set('col', false);
}),
Checkbox::make('col')
->reactive()
->afterStateUpdated(function($state, $set) {
$set('uol', false);
}),
Checkbox::make('uol')
->reactive()
->afterStateUpdated(function($state, $set) {
$set('col', false);
}),
reactive() is replaced with live() in v3.
waqar
waqarOP2y ago
ok will check that

Did you find this page helpful?