summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2001-06-18 20:51:58 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2001-06-18 20:51:58 +0000
commit8367d662fcaad1c09e48ae36bc4249b60570aefb (patch)
tree32f3b99d6358b8c74a40958fa978d336c3b73863
parent542b60a19a3c95df99c6a14493bbc0bf167ae886 (diff)
downloadbrdo-8367d662fcaad1c09e48ae36bc4249b60570aefb.tar.gz
brdo-8367d662fcaad1c09e48ae36bc4249b60570aefb.tar.bz2
Changes
- Modifed form_select() to accept an optional 6th parameter which is appeneded to the select tag. $value can now also be an array. This allows for multiple selects: form_select($header, $name, $values, $options, $help, "multiple=\"true\" size=\"10\""); - Updated account.module to use the extended form_select() functionality.
-rw-r--r--includes/common.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc
index ac78a5d4c..e52760ec0 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -179,10 +179,10 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) {
return form_item($title, "<textarea wrap=\"virtual\" cols=\"$cols\" rows=\"$rows\" name=\"edit[$name]\">". check_form($value) ."</textarea>", $description);
}
-function form_select($title, $name, $value, $options, $description = 0) {
+function form_select($title, $name, $value, $options, $description = 0, $extra = 0) {
if (count($options) > 0) {
- foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". ($key == $value ? " selected" : "") .">". check_form($choice) ."</option>";
- return form_item($title, "<select name=\"edit[$name]\">$select</select>", $description);
+ foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". (is_array($value) ? (in_array($key, $value) ? " selected" : "") : ($key == $value ? " selected" : "")) .">". check_form($choice) ."</option>";
+ return form_item($title, "<select name=\"edit[$name]\"". ($extra ? " $extra" : "") .">$select</select>", $description);
}
}