Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't remove onchange after click on add

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1145 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit 8ddbf4372241cdde36246d72cc9d373e2a6bc24b 1 parent 3675fe6
jakubvrana authored
Showing with 10 additions and 4 deletions.
  1. +1 −1  adminer/include/editing.inc.php
  2. +9 −3 adminer/static/editing.js
View
2  adminer/include/editing.inc.php
@@ -182,7 +182,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
<td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo h($field["comment"]); ?>" maxlength="255">
<?php } ?>
<?php
- echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='var x = editing_add_row(this, $allowed); if (x) { x.focus(); x.onchange = function () { }; } return !x;'>";
+ echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editing_add_row(this, $allowed, 1);'>";
echo "&nbsp;<input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);'>";
echo "&nbsp;<input type='image' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>";
echo "&nbsp;<input type='image' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>";
View
12 adminer/static/editing.js
@@ -91,7 +91,7 @@ function editing_name_change(field) {
}
}
-function editing_add_row(button, allowed) {
+function editing_add_row(button, allowed, focus) {
if (allowed && row_count >= allowed) {
return false;
}
@@ -107,7 +107,7 @@ function editing_add_row(button, allowed) {
}
tags = row.getElementsByTagName('input');
tags2 = row2.getElementsByTagName('input');
- var ret = tags2[0]; // IE loose tags2 after insertBefore()
+ var input = tags2[0]; // IE loose tags2 after insertBefore()
for (var i=0; i < tags.length; i++) {
if (tags[i].name == 'auto_increment_col') {
tags2[i].value = x;
@@ -125,9 +125,15 @@ function editing_add_row(button, allowed) {
editing_name_change(tags[0]);
};
row.parentNode.insertBefore(row2, row.nextSibling);
+ if (focus) {
+ input.onchange = function () {
+ editing_name_change(input);
+ };
+ input.focus();
+ }
added += '0';
row_count++;
- return ret;
+ return true;
}
function editing_remove_row(button) {
Please sign in to comment.
Something went wrong with that request. Please try again.