var unsaved = false; function strPackArrInit() { $('.is-array').each(function(index) { $(this).prev().append('' + ''); }); } function strPackArrAdd(elem) { elem = elem.parentNode.parentNode.nextElementSibling; var rows = $(elem).find("tr"); rows.last().after(rows.first().next().clone().removeClass("hidden")); rows = $(elem).find("tr"); rows.each(function(index) { index--; $(this).find("*[name$=']']").each(function(index2) { if($(this).attr('name') != undefined) $(this).attr('name', $(this).attr('name').replace('[0]', '[' + index + ']')); if($(this).attr('id') != undefined) $(this).attr('id', $(this).attr('id').replace('[0]', '[' + index + ']')); if($(this).attr('onchange') != undefined) $(this).attr('onchange', $(this).attr('onchange').replace('[0]', '[' + index + ']')); }); $(this).find("label[for$=']']").each(function(index2) { $(this).attr('for', $(this).attr('for').replace('[0]', '[' + index + ']')); }); }); rows.last().find("input:hidden").val(0); rows.last().find("select").addClass("selectpicker"); $('.selectpicker').selectpicker('refresh'); } function strPackArrDel(elem) { $(elem).parent().parent().remove(); } function findSubEntries(elem, type, target) { target = "#" + target.replace("[", "\\[").replace("]", "\\]"); var telem = $(target)[0]; var addText = "neu..."; $(telem.options).each(function(index, elem) { if($(elem).val() == -1) addText = $(elem).text(); }); if(elem.value != 0) { $.getJSON("/dynamic/" + type + "/" + $(elem).val(), function(data) { $(telem).empty(); $(telem).append(new Option("-bitte wählen-", 0)); $.each(data, function(key, value) { $(telem).append($("