aboutsummaryrefslogtreecommitdiffstats
path: root/root/base/select
diff options
context:
space:
mode:
Diffstat (limited to 'root/base/select')
-rw-r--r--root/base/select38
1 files changed, 38 insertions, 0 deletions
diff --git a/root/base/select b/root/base/select
new file mode 100644
index 0000000..a387fa1
--- /dev/null
+++ b/root/base/select
@@ -0,0 +1,38 @@
+[%
+
+PROCESS field_base;
+
+control_block = 'select_control';
+
+BLOCK select_control;
+
+ IF values_list_type;
+ values_list = self.${values_list_type};
+ ELSE;
+ values_list = self.valid_values;
+ END;
+
+ name = attrs.name || 'value'; attrs.name = '';
+ '<select ';
+ IF id_attr; 'id="'; id_attr; '"'; END;
+ connect_control(self, name); process_attrs(attrs); ">\n";
+
+ IF attrs.nullable == 1 || !(self.attribute.required);
+ attrs.nullable = '';
+ " <option value=\"\">--</option>\n";
+ END;
+
+ FOREACH v_val IN values_list;
+ v_val = self.obj_to_str(v_val);
+ v_name = self.value_to_name_map.${v_val} || v_val;
+ ' <option value="'; v_val | html; '"';
+ IF (self.is_current_value(v_val) || self.value == v_val ) && !self.hide_selected;
+ ' selected="selected"';
+ END;
+ '>'; v_name | html; "</option>\n";
+ END;
+ '</select>';
+
+END;
+
+%]