From: scyrma Date: Mon, 18 Aug 2008 06:40:41 +0000 (+0000) Subject: MDL-16036: make the default value in popup_form "selected" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ffadf71ba8791a5f22f28b7c06170ef0dc1454eb;p=moodle.git MDL-16036: make the default value in popup_form "selected" --- diff --git a/lib/weblib.php b/lib/weblib.php index 5cab18a80b..e992fe9ae6 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1101,7 +1101,16 @@ $targetwindow='self', $selectlabel='', $optionsextra=NULL) { } if ($nothing != '') { - $output .= " \n"; + $selectlabeloption = ''; + if ($selected=='') { + $selectlabeloption = ' selected="selected"'; + } + foreach ($options as $value => $label) { //if one of the options is the empty value, don't make this the default + if ($value == '') { + $selected = ''; + } + } + $output .= " \n"; } $inoptgroup = false;