summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--httemplate/edit/elements/part_svc_column.html3
-rwxr-xr-xhttemplate/edit/part_svc.cgi11
2 files changed, 14 insertions, 0 deletions
diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html
index d03c49d2f..fbea9bd6d 100644
--- a/httemplate/edit/elements/part_svc_column.html
+++ b/httemplate/edit/elements/part_svc_column.html
@@ -157,6 +157,9 @@ that field.
'multiple' => $def->{'multiple'},
'disable_empty' => 1,
'curr_value' => $value,
+ # these can be switched between multiple and singular,
+ # so put the complete curr_value in an attribute
+ 'element_etc' => 'default="'.encode_entities($value).'"',
&>
% } else {
% my (@options, %labels);
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 58c237efd..2ec024269 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -72,6 +72,17 @@ function flag_changed(obj) {
select.className = 'enabled';
if ( newflag == 'S' || select.getAttribute('should_be_multiple') ) {
select.multiple = true;
+ var defaults = select.getAttribute('default');
+ if ( defaults ) {
+ defaults = defaults.split(',');
+ for (var i = 0; i < defaults.length; i++) {
+ for (j = 0; j < select.options.length; j++ ) {
+ if ( defaults[i] == select.options[j].value ) {
+ select.options[j].selected = true;
+ }
+ }
+ }
+ }
} else {
select.multiple = false;
}