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
This commit is contained in:
parent
3675fe6feb
commit
8ddbf43722
|
@ -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">
|
<td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo h($field["comment"]); ?>" maxlength="255">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?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 " <input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);'>";
|
echo " <input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);'>";
|
||||||
echo " <input type='image' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>";
|
echo " <input type='image' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>";
|
||||||
echo " <input type='image' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>";
|
echo " <input type='image' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>";
|
||||||
|
|
|
@ -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) {
|
if (allowed && row_count >= allowed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ function editing_add_row(button, allowed) {
|
||||||
}
|
}
|
||||||
tags = row.getElementsByTagName('input');
|
tags = row.getElementsByTagName('input');
|
||||||
tags2 = row2.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++) {
|
for (var i=0; i < tags.length; i++) {
|
||||||
if (tags[i].name == 'auto_increment_col') {
|
if (tags[i].name == 'auto_increment_col') {
|
||||||
tags2[i].value = x;
|
tags2[i].value = x;
|
||||||
|
@ -125,9 +125,15 @@ function editing_add_row(button, allowed) {
|
||||||
editing_name_change(tags[0]);
|
editing_name_change(tags[0]);
|
||||||
};
|
};
|
||||||
row.parentNode.insertBefore(row2, row.nextSibling);
|
row.parentNode.insertBefore(row2, row.nextSibling);
|
||||||
|
if (focus) {
|
||||||
|
input.onchange = function () {
|
||||||
|
editing_name_change(input);
|
||||||
|
};
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
added += '0';
|
added += '0';
|
||||||
row_count++;
|
row_count++;
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function editing_remove_row(button) {
|
function editing_remove_row(button) {
|
||||||
|
|
Loading…
Reference in a new issue