Merged tabindex forchoose_from_menu from stable

This commit is contained in:
moodler 2005-11-03 05:12:12 +00:00
parent e168c90403
commit 25e5dbf9e7

View file

@ -651,7 +651,8 @@ function close_window($delay=0) {
* @param type description * @param type description
* @todo Finish documenting this function * @todo Finish documenting this function
*/ */
function choose_from_menu ($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false) { function choose_from_menu ($options, $name, $selected='', $nothing='choose', $script='',
$nothingvalue='0', $return=false, $disabled=false, $tabindex=0) {
if ($nothing == 'choose') { if ($nothing == 'choose') {
$nothing = get_string('choose') .'...'; $nothing = get_string('choose') .'...';
@ -662,6 +663,10 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc
$attributes .= ' disabled="disabled"'; $attributes .= ' disabled="disabled"';
} }
if ($tabindex) {
$attributes .= ' tabindex="'.$tabindex.'"';
}
$output = '<select id="menu'.$name.'" name="'. $name .'" '. $attributes .'>' . "\n"; $output = '<select id="menu'.$name.'" name="'. $name .'" '. $attributes .'>' . "\n";
if ($nothing) { if ($nothing) {
$output .= ' <option value="'. $nothingvalue .'"'. "\n"; $output .= ' <option value="'. $nothingvalue .'"'. "\n";