wbraganca / yii2-dynamicform

It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Other
436 stars 439 forks source link

Bug when try to create any id atrribute in any HTML tag #193

Open calcio opened 7 years ago

calcio commented 7 years ago

I need create some IDs attribute in HTML tag, but when I try it in any HTML tag the widget don't work correctly. The add Item stop to count Eg. Address 1, Address 2 etc.. When I try use id in form tag it lost his reference cont and put "-0-" in array position.

In form field <?= $form->field($modelWater, "[{$i}]pre_weight")->textInput(['id' => "water_pre_weight[{$i}]"])->label(false) ?>

HTML Code BEFORE click add buttom <input id="water_pre_weight[0]" class="form-control" name="Water[0][pre_weight]" value="666" type="text">

HTML Code AFTER click add buttom <input id="water_pre_weight[-0-]" class="form-control" name="Water[0][pre_weight]" value="666" type="text">

if I try to use attribute id in a td tag the same bug happen. ex: <td id="any-name[]"></rd>

And the item add start with 1 (one) again. It can be notice in create action.

PHP Version 7.0 Yii Version 2.0.11