]> git.joonet.de Git - adminer.git/commitdiff
Don't autofocus computed fields in insert form
authorJakub Vrana <jakub@vrana.cz>
Mon, 3 Mar 2025 05:34:02 +0000 (06:34 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 3 Mar 2025 05:34:02 +0000 (06:34 +0100)
adminer/include/functions.inc.php
changes.txt

index e39322dfb89f49f8985fa051f0eb3185f8380256..71e2de0bd3fca9f3933d2e24cea4a0f17f0c2bdb 100644 (file)
@@ -1411,6 +1411,7 @@ function edit_form($table, $fields, $row, $update) {
                echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
        } else {
                echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
+               $first = 0;
                foreach ($fields as $name => $field) {
                        echo "<tr><th>" . $adminer->fieldName($field);
                        $default = $_GET["set"][bracket_escape($name)];
@@ -1451,6 +1452,9 @@ function edit_form($table, $fields, $row, $update) {
                                $value = "";
                                $function = "uuid";
                        }
+                       if ($field["auto_increment"] || $function == "now" || $function == "uuid") {
+                               $first++;
+                       }
                        input($field, $value, $function);
                        echo "\n";
                }
@@ -1477,7 +1481,7 @@ function edit_form($table, $fields, $row, $update) {
                }
        }
        echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'>" . confirm() . "\n"
-               : ($_POST || !$fields ? "" : script("focus(qsa('td', qs('#form'))[1].firstChild);"))
+               : ($_POST || !$fields ? "" : script("focus(qsa('td', qs('#form'))[2*$first+1].firstChild);"))
        );
        if (isset($_GET["select"])) {
                hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));
index c2563e4b01bb7e5b3b14876b5c0ce9f2ac776366..8106b8d0149bad5603900197fc98bf81c07f9c12 100644 (file)
@@ -1,5 +1,6 @@
 Adminer dev:
 Speed up with disabled output buffering
+Don't autofocus computed fields in insert form
 PostgreSQL: Do not alter indexes with expressions
 PostgreSQL: Fix export of indexes with expressions (bug #768)
 PostgreSQL: Display ENUM types