summaryrefslogtreecommitdiff
path: root/swat/scripting
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-30 08:50:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:15 -0500
commit69ed145260990213fb98966825f130dfccb2b7c3 (patch)
tree2dd8064d3773325b80cf282fad1f8485f540e2a3 /swat/scripting
parent2f055ca68b76f1eff5ebce5c2fb29e0294be3a4c (diff)
downloadsamba-69ed145260990213fb98966825f130dfccb2b7c3.tar.gz
samba-69ed145260990213fb98966825f130dfccb2b7c3.tar.bz2
samba-69ed145260990213fb98966825f130dfccb2b7c3.zip
r7096: added support for select lists in forms
(This used to be commit 33d21d35feaa0f7f9d4067e90495ca19374cea78)
Diffstat (limited to 'swat/scripting')
-rw-r--r--swat/scripting/common.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/swat/scripting/common.js b/swat/scripting/common.js
index d9e3b56bce..8396a3adc2 100644
--- a/swat/scripting/common.js
+++ b/swat/scripting/common.js
@@ -121,7 +121,7 @@ function Form(name, num_elements, num_submits)
f.submit = an array of submit labels
f.element[i].label = element label
f.element[i].name = element name (defaults to label)
- f.element[i].type = element type
+ f.element[i].type = element type (defaults to text)
f.element[i].value = current value (optional, defaults to "")
*/
function display_form(f) {
@@ -139,13 +139,24 @@ function display_form(f) {
}
write("<tr>");
write("<td>" + e.label + "</td>");
- write('<td><input name="' + e.name + '" type="' +
- e.type + '" value="' + e.value + '"></td>\n');
+ if (e.type == "select") {
+ write('<td><select name="' + e.name + '">\n');
+ for (s in e.list) {
+ if (e.value == e.list[s]) {
+ write('<option selected=selected>' + e.list[s] + '</option>\n');
+ } else {
+ write('<option>' + e.list[s] + '</option>\n');
+ }
+ }
+ write('</select></td>\n');
+ } else {
+ write('<td><input name="' + e.name + '" type="' +
+ e.type + '" value="' + e.value + '"></td>\n');
+ }
}
write("</table>\n");
for (i in f.submit) {
- write('<input name="' + f.submit[i] +
- '" type="submit" value="' + f.submit[i] + '">\n');
+ write('<input name="submit" type="submit" value="' + f.submit[i] + '">\n');
}
write("</form>\n");
}