diff options
-rw-r--r-- | views/default/input/pulldown.php | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php index a83534c41..520a62c88 100644 --- a/views/default/input/pulldown.php +++ b/views/default/input/pulldown.php @@ -15,7 +15,8 @@ * @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
* @uses $vars['options'] An array of strings representing the options for the pulldown field
- *
+ * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is + * the value displayed on the button. Replaces $vars['options'] when defined.
*/
?>
@@ -23,14 +24,25 @@ <select name="<?php echo $vars['internalname']; ?>" <?php echo $vars['js']; ?>>
<?php
-
- foreach($vars['options'] as $option) {
- if ($option != $vars['value']) {
- echo "<option>{$option}</option>";
- } else {
- echo "<option selected=\"selected\">{$option}</option>";
- }
- }
-
+ if ($vars['options_values']) + { + foreach($vars['options_values'] as $value => $option) { + if ($value != $vars['value']) { + echo "<option value=\"$value\">{$option}</option>"; + } else { + echo "<option value=\"$value\" selected=\"selected\">{$option}</option>"; + } + } + } + else + {
+ foreach($vars['options'] as $option) {
+ if ($option != $vars['value']) {
+ echo "<option>{$option}</option>";
+ } else {
+ echo "<option selected=\"selected\">{$option}</option>";
+ }
+ }
+ }
?>
</select>
\ No newline at end of file |