1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Fix for numeric form drop-downs.

This commit is contained in:
Cameron
2017-04-14 11:00:29 -07:00
parent ab890d9fe8
commit 90d533ba52
2 changed files with 8 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ function varset(&$val, $default='')
*/ */
function defset($str, $default='') function defset($str, $default='')
{ {
if(!is_string($str)) if(is_array($str))
{ {
return false; return false;
} }

View File

@@ -2601,7 +2601,7 @@ class e_form
$option_array = array(1 => LAN_YES, 0 => LAN_NO); $option_array = array(1 => LAN_YES, 0 => LAN_NO);
} }
if(vartrue($options['multiple'])) if(!empty($options['multiple']))
{ {
$name = (strpos($name, '[') === false) ? $name.'[]' : $name; $name = (strpos($name, '[') === false) ? $name.'[]' : $name;
if(!is_array($selected)) $selected = explode(",",$selected); if(!is_array($selected)) $selected = explode(",",$selected);
@@ -2829,7 +2829,10 @@ class e_form
*/ */
function option_multi($option_array, $selected = false, $options = array()) function option_multi($option_array, $selected = false, $options = array())
{ {
if(is_string($option_array)) parse_str($option_array, $option_array); if(is_string($option_array))
{
parse_str($option_array, $option_array);
}
$text = ''; $text = '';
@@ -2838,6 +2841,7 @@ class e_form
return $this->option('',''); return $this->option('','');
} }
foreach ($option_array as $value => $label) foreach ($option_array as $value => $label)
{ {
if(is_array($label)) if(is_array($label))
@@ -2847,6 +2851,7 @@ class e_form
} }
else else
{ {
$text .= $this->option($label, $value, (is_array($selected) ? in_array($value, $selected) : $selected == $value), $options)."\n"; $text .= $this->option($label, $value, (is_array($selected) ? in_array($value, $selected) : $selected == $value), $options)."\n";
} }
} }