Answer the question
In order to leave comments, you need to log in
ActiveCheckboxList (Yii2) how to change value values?
I conclude this way
echo Html::activeCheckboxList($model,'brand',$brands)
<label><input type="checkbox" name="Search[brand][]" value="1"> Asus</label>
<label><input type="checkbox" name="Search[brand][]" value="2"> Acer</label>
<label><input type="checkbox" name="Search[brand][]" value="3"> Lenovo</label>
Answer the question
In order to leave comments, you need to log in
Good afternoon.
What do you want to change to?
Maybe ArrayHelper() will help you
Your $brands looks like this:
which is equivalent to this:
The script does not number anything, it takes the keys for value
You probably need to bring your array of values to this form:
I can tell you how if you show the code where you form $brands
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question