From 79716a80487e8afabb6791f19520d559b52198c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Sat, 7 Oct 2006 15:02:17 +0000 Subject: [PATCH] new function to gather selected checkboxes --- etemplate/js/etemplate.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/etemplate/js/etemplate.js b/etemplate/js/etemplate.js index f68fa60855..7c40ca2f44 100644 --- a/etemplate/js/etemplate.js +++ b/etemplate/js/etemplate.js @@ -224,3 +224,17 @@ function enable_button(id) { document.getElementById(id).style.color = ''; } +// returns selected checkboxes from given 'var form' which REAL names end with 'var suffix' +function get_selected(form,suffix) { + selected = ''; + el = form.getElementsByTagName('input'); + for (var i = 0; i < el.length; i++) { + if(el[i].name.substr(el[i].name.length-suffix.length,el[i].name.length) == suffix && el[i].checked) { + if(selected.length > 0) { + selected += ','; + } + selected += el[i].value; + } + } + return selected; +}