yii2-dynamicform icon indicating copy to clipboard operation
yii2-dynamicform copied to clipboard

Duplicate form and will copy first form data

Open xuanzi23 opened this issue 8 years ago • 3 comments

Hi, recently i using this plug in my project. I found out will duplicate form like example when i press '+' once will add many form at below.

Second problem is, when i save, after that i add new form will clone the first row data at below. I need clear it myself quite weird. anything will cause this thing happen?

xuanzi23 avatar Feb 07 '17 08:02 xuanzi23

I had same the problem with nested tables. Solution was to rename every nested table with parent index index.

<?php
DynamicFormWidget::begin([
	'widgetContainer' => 'dynamicform_inner',
	'widgetBody' => '.container-qvariants-'.$index,
	'widgetItem' => '.qvariant-item-'.$index,
	'limit' => 4,
	'min' => 2,
	'insertButton' => '.add-qvariant-'.$index,
	'deleteButton' => '.remove-qvariant-'.$index,
	'model' => $subModels[0],
	'formId' => 'dynamic-form',
	'formFields' => [
		'option',
		'points',
	],
]);
?>

kullarkert avatar Mar 09 '17 22:03 kullarkert

I have the same issue. I don't have nested tables. @xuanzi23, can you resolve it?

koquipizzi avatar Dec 19 '17 12:12 koquipizzi

@koquipizzi, I found a solution here, but now I can`t find the link (author, sorry):

// $toclone = $(widgetOptions.template); $toclone = _parseTemplate(widgetOptions);

in yii2-dynamic-form.js (_addItem method).

VladimirBazhenov avatar Apr 18 '19 23:04 VladimirBazhenov