I am in need of help once more.
I have a form for a father model that can add child model forms on the fly based on an index. You can find this approach around the net for both yii2 and yii.
So I have something like:
<?= Html::activeInput('text', $model, '[' . $index . ']attribute'); ?>
in my child form, which works fine, once I submit it, it returns a nice array of model data.
The problem arises when I switched to a drop down list for one of my attributes and set it like :
<?= Html::activeDropDownList( $model, "[$index]attribute",['op1', 'op2']); ?>
which does NOT return in my array (or anywhere, for that matter).
Does anyone know why this is?
Figured it out,
all of your dropdowns need to have their $items in the
format AND their name and id need to look like this in source: [html]<id="modelname-0-attribute" name="ModelName[attribute]">[/html].
The "0" there is the $index value.
So in your code you need
for your attribute drop downs and
for your miscellaneous drop downs.
If you get that wrong, your other drop downs(or maybe just the ones before it) won’t send data upon submit.