F
Filament15mo ago
waqar

repeater checkbox problem

want only select one checkbox in repeter form how can i handle
No description
14 Replies
waqar
waqarOP15mo ago
hello any one available ?
toeknee
toeknee15mo 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
waqarOP15mo 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
toeknee15mo ago
Ok we need to see your code how you have built the above for us to understand it.
waqar
waqarOP15mo ago
No description
waqar
waqarOP15mo ago
actully when afterStateUpdated trigred he only get current state get not get other
toeknee
toeknee15mo ago
Ugh that's a mess, you are setting the one thats updated
waqar
waqarOP15mo ago
yeah it pick only current state
toeknee
toeknee15mo 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
waqarOP15mo ago
ok when i click on checkbox cliecked chekcbox unchecked and not impect other checkbox
toeknee
toeknee15mo ago
You need to add ->reactive() to the checkboxes...
waqar
waqarOP15mo ago
i have add live() now will remove live() and replace reactive()
toeknee
toeknee15mo 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
waqarOP15mo ago
ok will check that
Want results from more Discord servers?
Add your server