]> git.mjollnir.org Git - moodle.git/commitdiff
Much cooler way to set the form focus after an error. Sent in by Greg Barnett.
authormoodler <moodler>
Sat, 14 Dec 2002 08:24:34 +0000 (08:24 +0000)
committermoodler <moodler>
Sat, 14 Dec 2002 08:24:34 +0000 (08:24 +0000)
login/signup.php

index d53f59ef75105b81e34b225e267229ff919aab22..c3988fc36821e12c2bad9fcf037c039f4ee181f1 100644 (file)
                }
        }
 
-       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;