From f8c821ba181099620e7c36bf409afc9fed6a21c4 Mon Sep 17 00:00:00 2001 From: Christophe Croullebois Date: Sat, 10 Dec 2011 18:39:37 +0100 Subject: [PATCH] Bug 7350: In neworderempty.pl duplicating an item does not preserve select box selections cloneNode() does not preserve select box selections, I have created a function to duplicate them : "clone_with_selected". It is included in "cloneItemBlock", that's all. Now the values selected in ddl are duplicated as the imput-texts are. Signed-off-by: Paul Poulain (cherry picked from commit a47f59f72fdb8bd55731f4dc362d710234ddc1a8) Signed-off-by: Chris Nighswonger (cherry picked from commit d3462cdf803bde0a2aeaf3ec16a5b90e596a25b9) Signed-off-by: Chris Nighswonger --- koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js index 86583244a4..20db624127 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js @@ -6,7 +6,7 @@ function deleteItemBlock(index) { } function cloneItemBlock(index) { var original = document.getElementById(index); //original
- var clone = original.cloneNode(true); + var clone = clone_with_selected(original) var random = Math.floor(Math.random()*100000); // get a random itemid. // set the attribute for the new 'div' subfields clone.setAttribute('id',index + random);//set another id. @@ -54,6 +54,19 @@ function check_additem() { // duplicates within the form. return success; } + +function clone_with_selected (node) { + var origin = node.getElementsByTagName("select"); + var tmp = node.cloneNode(true) + var selectelem = tmp.getElementsByTagName("select"); + for (var i=0; i