diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/classes/Form/Select.class.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/usr/local/www/classes/Form/Select.class.php b/src/usr/local/www/classes/Form/Select.class.php index 1c4594d..c7d73c1 100644 --- a/src/usr/local/www/classes/Form/Select.class.php +++ b/src/usr/local/www/classes/Form/Select.class.php @@ -54,10 +54,17 @@ class Form_Select extends Form_Input $options = ''; foreach ($this->_values as $value => $name) { + // Things can get wierd if we have mixed types + $sval = $this->_value; + + if( (gettype($value) == "integer") && (gettype($sval) == "string") ) + $value = strval($value); + if (isset($this->_attributes['multiple'])) - $selected = in_array($value, (array)$this->_value); - else - $selected = ($this->_value == $value); + $selected = in_array($value, (array)$sval); + else { + $selected = ($sval == $value); + } $options .= '<option value="'. htmlspecialchars($value) .'"'.($selected ? ' selected' : '').'>'. htmlspecialchars(gettext($name)) .'</option>'; } |