diff --git a/js/forms/forms.js b/js/forms/forms.js index 92334671b2..d7f75e31d8 100644 --- a/js/forms/forms.js +++ b/js/forms/forms.js @@ -3,12 +3,28 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - - function triggerTurbo(el) { let sFormName = el.form.getAttribute("name"); el.form.querySelector(`[name="${sFormName}[_turbo_trigger]"]`).value = el.getAttribute('name'); el.form.setAttribute('novalidate', true); el.form.requestSubmit(); console.log('Auto submitting form due to change in field ' + el.getAttribute('name')); +} + +function addFormToCollection(e) { + const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass); + const item = document.createElement('div'); + + item.style.marginTop = '20px'; + item.innerHTML = collectionHolder + .dataset + .prototype + .replace( + /__name__/g, + collectionHolder.dataset.index + ); + + collectionHolder.appendChild(item); + collectionHolder.dataset.index++; + console.log(collectionHolder.dataset.index); } \ No newline at end of file diff --git a/sources/Forms/Block/FormType/FormType.php b/sources/Forms/Block/FormType/FormType.php index adf6b77c8f..5faec68559 100644 --- a/sources/Forms/Block/FormType/FormType.php +++ b/sources/Forms/Block/FormType/FormType.php @@ -31,7 +31,6 @@ class FormType extends AbstractType 'name' => $oChild->GetName(), 'added' => $oChild->IsAdded(), 'id' => $oChild->GetIdentifier(), - 'path' => $oFormChild->getPropertyPath(), ]; } else{ diff --git a/templates/application/forms/itop_console_layout.html.twig b/templates/application/forms/itop_console_layout.html.twig index 5be298cf86..49c9adb13d 100644 --- a/templates/application/forms/itop_console_layout.html.twig +++ b/templates/application/forms/itop_console_layout.html.twig @@ -48,7 +48,7 @@ {%- block form_rows -%} {% for block in blocks %} -