From fb3b23617dae7b28a7c8ad531b23216ffb58c27b Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 3 Mar 2025 06:34:02 +0100 Subject: [PATCH] Don't autofocus computed fields in insert form --- adminer/include/functions.inc.php | 6 +++++- changes.txt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index e39322df..71e2de0b 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -1411,6 +1411,7 @@ function edit_form($table, $fields, $row, $update) { echo "

" . lang('You have no privileges to update this table.') . "\n"; } else { echo "" . script("qsl('table').onkeydown = editingKeydown;"); + $first = 0; foreach ($fields as $name => $field) { echo "
" . $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 ? "" . 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"])); diff --git a/changes.txt b/changes.txt index c2563e4b..8106b8d0 100644 --- a/changes.txt +++ b/changes.txt @@ -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