1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-09 16:17:48 +02:00

Don't autofocus computed fields in insert form

This commit is contained in:
Jakub Vrana
2025-03-03 06:34:02 +01:00
parent dfe3cc1888
commit fb3b23617d
2 changed files with 6 additions and 1 deletions

View 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"; echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else { } else {
echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;"); echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
$first = 0;
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field); echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)]; $default = $_GET["set"][bracket_escape($name)];
@@ -1451,6 +1452,9 @@ function edit_form($table, $fields, $row, $update) {
$value = ""; $value = "";
$function = "uuid"; $function = "uuid";
} }
if ($field["auto_increment"] || $function == "now" || $function == "uuid") {
$first++;
}
input($field, $value, $function); input($field, $value, $function);
echo "\n"; 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" 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"])) { if (isset($_GET["select"])) {
hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"])); hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));

View File

@@ -1,5 +1,6 @@
Adminer dev: Adminer dev:
Speed up with disabled output buffering Speed up with disabled output buffering
Don't autofocus computed fields in insert form
PostgreSQL: Do not alter indexes with expressions PostgreSQL: Do not alter indexes with expressions
PostgreSQL: Fix export of indexes with expressions (bug #768) PostgreSQL: Fix export of indexes with expressions (bug #768)
PostgreSQL: Display ENUM types PostgreSQL: Display ENUM types