From: moodler Date: Sat, 14 Dec 2002 08:24:34 +0000 (+0000) Subject: Much cooler way to set the form focus after an error. Sent in by Greg Barnett. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=93f03cc436f89c8f17fc11958670a254f1d10a81;p=moodle.git Much cooler way to set the form focus after an error. Sent in by Greg Barnett. --- diff --git a/login/signup.php b/login/signup.php index d53f59ef75..c3988fc368 100644 --- a/login/signup.php +++ b/login/signup.php @@ -34,11 +34,9 @@ } } - if ($err) { - foreach ((array)$err as $key => $value) { - $focus = "form.$key"; - } - } + if ($err) { + $focus = 'form.' . array_shift(array_flip(get_object_vars($err))); + } if (!$user->country and $CFG->country) { $user->country = $CFG->country;