Skip to content

Commit

Permalink
Set autofocus on first row score - refs #7514
Browse files Browse the repository at this point in the history
  • Loading branch information
ilosada committed Feb 18, 2015
1 parent a1edcb8 commit 0c09c57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main/gradebook/lib/fe/evalform.class.php
Expand Up @@ -271,12 +271,18 @@ protected function build_result_add_form()
);
}

$firstUser = true;
foreach ($tblusers as $user) {

$element_name = 'score[' . $user[0] . ']';


$scoreColumnProperties = array('class' => 'span1', 'maxlength' => 5);
if ($firstUser) {
$scoreColumnProperties['autofocus'] = '';
$firstUser = false;
}
//user_id, user.username, lastname, firstname
$this->add_textfield($element_name, $this->build_stud_label($user[0], $user[1], $user[2], $user[3]), false, array('class' => 'span1', 'maxlength' => 5));
$this->add_textfield($element_name, $this->build_stud_label($user[0], $user[1], $user[2], $user[3]), false, $scoreColumnProperties);

$this->addRule($element_name, get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array($element_name, 'maxvalue'), get_lang('OverMax'), 'compare', '<=');
Expand Down

0 comments on commit 0c09c57

Please sign in to comment.