S
S
Sergey Melnikov2015-08-08 10:05:29
Yii
Sergey Melnikov, 2015-08-08 10:05:29

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

2 answer(s)
A
Andrey Pavlenko, 2015-08-08
@Akdmeh

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

S
Sergey Melnikov, 2015-08-08
@azazel_live

Damn, this is how
ArrayHelper::map($arr,'value','value') worked

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question