Add editing row after writing first character

This commit is contained in:
Jakub Vrana 2013-07-10 09:02:31 -07:00
parent 07db5e0bfb
commit 20285c4550
2 changed files with 3 additions and 3 deletions

View file

@ -244,7 +244,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
?>
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeypress="if (this.value) editingAddRow(this);'); ?>" maxlength="64" autocapitalize="off"><?php } ?>
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);'); ?>" maxlength="64" autocapitalize="off"><?php } ?>
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
<?php if ($type == "TABLE") { ?>

View file

@ -317,14 +317,14 @@ function editingAddRow(button, focus) {
tags[0].onchange = function () {
editingNameChange(tags[0]);
};
tags[0].onkeypress = function () {
tags[0].onkeyup = function () {
};
row.parentNode.insertBefore(row2, row.nextSibling);
if (focus) {
input.onchange = function () {
editingNameChange(input);
};
input.onkeypress = function () {
input.onkeyup = function () {
};
input.focus();
}