From 93f03cc436f89c8f17fc11958670a254f1d10a81 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 14 Dec 2002 08:24:34 +0000 Subject: [PATCH] Much cooler way to set the form focus after an error. Sent in by Greg Barnett. --- login/signup.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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; -- 2.39.5