From ffadf71ba8791a5f22f28b7c06170ef0dc1454eb Mon Sep 17 00:00:00 2001 From: scyrma Date: Mon, 18 Aug 2008 06:40:41 +0000 Subject: [PATCH] MDL-16036: make the default value in popup_form "selected" --- lib/weblib.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; -- 2.39.5