I have a multidimensional array value for form attribute that I need to be included with form as hidden inputs.
$model->ids = ['first' => [1, 2], 'second' => [22]];
I can't use activeHiddenInput as it gives error
// gives error: "Array to string conversion"
<?= Html::activeHiddenInput($model, 'ids')?>
Expected outcome:
<input type="hidden" name="formName[ids][first][]" value="1" />
<input type="hidden" name="formName[ids][first][]" value="2" />
<input type="hidden" name="formName[ids][second][]" value="22" />
.. or ..
<input type="hidden" name="formName[ids][first][0]" value="1" />
<input type="hidden" name="formName[ids][first][1]" value="2" />
<input type="hidden" name="formName[ids][second][0]" value="22" />
What would be the best approach to solve this in yii2 framework concept?