From: Moritz Bunkus Date: Tue, 4 Jun 2013 10:03:45 +0000 (+0200) Subject: JS-Multiselect2Side: Namen der temporären Controls von Original-ID und nicht -Name... X-Git-Tag: release-3.1.0beta1~370 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=89b7ddcb3281f76bef6d0cb29ea8d0c4817d40fa;p=kivitendo-erp.git JS-Multiselect2Side: Namen der temporären Controls von Original-ID und nicht -Name ableiten Der Name ist nicht zwangsläufig eindeutig, vor allem, wenn mehrere Elemente dieser Art auf einer Seite vorhanden sind. Beispiel: name="client[].users[]" mehrfach in einer Schleife ausgegeben. --- diff --git a/js/jquery.multiselect2side.js b/js/jquery.multiselect2side.js index e47a35fac..de74b6432 100644 --- a/js/jquery.multiselect2side.js +++ b/js/jquery.multiselect2side.js @@ -35,17 +35,19 @@ return this.each(function () { var el = $(this); - var hiddenName = $(this).attr("name"); - var originalName = $(this).attr("name"); - if (originalName.indexOf('[') != -1) - originalName = originalName.substring(0, originalName.indexOf('[')); - - var nameDx = originalName + "ms2side__dx"; - var idDx = originalName + "ms2side__dx"; - var nameSx = originalName + "ms2side__sx"; - var hiddenId = originalName + "ms2side_hidden"; + var hiddenName = $(this).attr("name"); + var originalID = $(this).attr("id"); + if (!originalID) + originalID = hiddenName; + if (originalID.indexOf('[') != -1) + originalID = originalID.substring(0, originalID.indexOf('[')); + + var nameDx = originalID + "ms2side__dx"; + var idDx = originalID + "ms2side__dx"; + var nameSx = originalID + "ms2side__sx"; + var hiddenId = originalID + "ms2side_hidden"; var size = $(this).attr("size"); - $(this).attr("name", originalName + "ms2side__orig"); + $(this).attr("name", originalID + "ms2side__orig"); // SIZE MIN if (size < 6) { $(this).attr("size", "6");