I have an active form instance which is showing form fields based on depdrop of Karthik
<?= $form->field($model, 'country')->dropDownList(Countries::getCountries(),
['id' => 'country_id', 'prompt' => 'Select countries'])
?>
Then
<?= $form->field($model, 'state')->widget(DepDrop::classname(), [
//'data' => Regions::getRegions($model->country),
'options' => ['id' => 'region_id', 'prompt' => 'Choose a country first'],
'pluginOptions' => [
'depends' => ['country_id'],
'placeholder' => 'Select a state',
'url' => Url::to(['/regions/regions'])
]
]) ?>
Then
<?= $form->field($model, 'city')->widget(DepDrop::classname(), [
//'data' => Cities::getCities($model->country),
'options' => ['id' => 'city_id', 'prompt' => 'Select a state'],
'pluginOptions' => [
'depends' => ['country_id','region_id'],
'placeholder' => 'Select',
'url' => Url::to(['/cities/cities'])
]
]) ?>
Then
<?= $form->field($model, 'publisher_name')->widget(DepDrop::classname(), [
//'data' => Cities::getCities($model->country),
'options' => ['id' => 'user_id', 'prompt' => 'Choose a publisher'],
'pluginOptions' => [
'depends' => ['country_id','region_id','city_id'],
'placeholder' => 'Select',
'url' => Url::to(['/publisher/publishers'])
]
]) ?>
Everything is working perfectly at the last part instead of drop down i want to show check box for example it is returning a json code
{"output":[{"user_id":"109","name":"user1"},{"user_id":"114","name":"user2"}],"selected":""}
I want to generate a checkbox based on this json code how can I do that