Open davidsoutoc opened 8 years ago
Hi! I have this problem too. I just forgot to write ActiveForm::end();. Meybe it help you
I also ran into this problem. console.log($toclone)
showed that the variable was a string containing HTML code of the nested form to duplicate. Of course, clone()
is not a function of the String class.
I fixed the bug by wrapping $toclone into a jQuery object :
$toclone = $(widgetOptions.template);
Unfortunately, I had to modify the yii2-dynamic-form.js file of the extension for I don't know how to overload these assets in my application code.
I'd ran to this problem by update to dev-master.
@ChristopheBrun it's late, but for other who experiencing this:
'components'=>[
..
'assetManager' => [
'bundles' => [
'wbraganca\dynamicform\DynamicFormAsset' => [
'sourcePath' => '@app/web/js',
'js' => [
'yii2-dynamic-form.js'
],
],
],
],
]
same here. @richardoctoey solution worked for me
yii2-dynamic-form.js:119 Uncaught TypeError: $toclone.clone is not a function
at _addItem (yii2-dynamic-form.js:119)
at jQuery.fn.init.addItem (yii2-dynamic-form.js:42)
at jQuery.fn.init.$.fn.yiiDynamicForm (yii2-dynamic-form.js:17)
at HTMLButtonElement.
Same issue as @Nik1192, anyone fixed ?
the problem is exist yet and the solution from @ChristopheBrun is helpful.
Hi,
I have a problem with this. I didn't get clone the elements. On console I obtain this error:
Uncaught TypeError: $toclone.clone is not a function on yii2-dynamic-form.js:120
I have defined correctly the jquery library, the other stuff on my projects with jquery works fine. If I put a console.log before the error line and I obtain the variable $toclone with the content of de div that I want clone and it looks ok.
If I added put this on the yii2-dynamic-form.js clone the div correctly but the original line continues with the error: var obj = $("div.item.panel.panel-default").eq(0).clone(); $("div.container-items").append(obj);
I don't understand what is the error.
Thanks for the help.