CheckBox List - All going on?
This is a weird one . . . when I add a checkbox all the options toggle/on/off . . when I submit the field is a boolean, not an array of values. Thoughts?
14 Replies
Also having this issue
where? Could you explain what is the issue?
I've placed a
CheckboxList
in a Wizard form thats in a custom Livewire Component.
When I click on any of the options, all of them are selected:
@Leandro Ferreira Strangely, when dumping the form's state on submission, the value is
true
instead of an array of selected keysDid you add
$this->form->fill()
in the mount method?
Are you using statePath
?I use
$this->form->fill()
to set some default values :
->statePath('data')
( Just the default variable choice )Could you please check if there is another field with the
selected_manufacturers
name?
This doesn't make senseThe issue seems to be with the way I'm conditionally assigning the
Wizard\Step
schema:
If I take out the conditional, and just return a CheckboxList
, it works fineTry simplifying the example and testing it again. If the problem persists, consider opening an issue on GitHub
ok - Is this a bad practice for conditionally rendering fields?
no, I guess
Typically you would put all the fields in the schema then use visible() or hidden() on each field or layout to handle the display.
I think conditionally render different data points is going to lead to state issues, even if it does kinda work.
Switching to
visible()
and hidden()
did solve my issue