wbraganca / yii2-dynamicform

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

Revert "Updated regex for ID" file input widget problem #302

Open simplyr opened 4 years ago

simplyr commented 4 years ago

The latest commit 75c4271 not working with widget-fileinput by kartik. You can see that in your example here dynamicform-demo2

When you pick an image and then try to duplicate you get this error: yii2-dynamic-form.min.js:8 Uncaught TypeError: Cannot read property 'widgetItem' of undefined at _updateAttrID (yii2-dynamic-form.min.js:8) at HTMLDivElement. (yii2-dynamic-form.min.js:8) at Function.each (jquery.js:374) at jQuery.fn.init.each (jquery.js:139) at HTMLTableRowElement. (yii2-dynamic-form.min.js:8) at Function.each (jquery.js:374) at jQuery.fn.init.each (jquery.js:139) at _updateAttributes (yii2-dynamic-form.min.js:8) at _addItem (yii2-dynamic-form.min.js:8) at jQuery.fn.init.addItem (yii2-dynamic-form.min.js:8)

When I replace: var regexID = /^(.+?)([-\d-]{1,})(.+)$/i; with the old one var regexID = /^(.+?)(-\d{1,}-)(.+)$/i; everything works just fine.