Answer the question
In order to leave comments, you need to log in
How to pass values from checkboxlist to controller?
Hi all.
I can't figure out how to pass values from
echo Html::checkboxList('check_values',[], ArrayHelper::getColumn($arr, 'value'), ['class' => 'checkbox']);
When submitting the form, the check_values parameter passes the number of the $arr array element, but you need to pass values, how to do this?
Answer the question
In order to leave comments, you need to log in
The third parameter should be array('key'=>'value'), and you are now only passing value.
It is necessary to search in ArrayHelper acc. method (I forgot what it's called, sorry, I don't have much time), or if you don't find it, run through $arr manually using foreach
Damn, this is how
ArrayHelper::map($arr,'value','value') worked
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question