Unselect original function on key up
This commit is contained in:
parent
3f47f63c61
commit
657191eed8
|
@ -267,7 +267,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||||
<?php if ($type == "TABLE") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block"); ?>
|
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block"); ?>
|
||||||
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"></label><td><?php
|
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"></label><td><?php
|
||||||
echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onkeyup="if (this.value != this.getAttribute('value')) { this.onchange(); this.setAttribute('value', this.value) }" onchange="this.previousSibling.checked = true;">
|
echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onkeyup="keyupChange.call(this);" onchange="this.previousSibling.checked = true;">
|
||||||
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : ""); ?>
|
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : ""); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -805,7 +805,7 @@ function input($field, $value, $function) {
|
||||||
}
|
}
|
||||||
$first++;
|
$first++;
|
||||||
}
|
}
|
||||||
$onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
|
$onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\" onkeyup='keyupChange.call(this);'" : "");
|
||||||
$attrs .= $onchange;
|
$attrs .= $onchange;
|
||||||
echo (count($functions) > 1
|
echo (count($functions) > 1
|
||||||
? "<select name='function[$name]' onchange='functionChange(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "") . "</select>"
|
? "<select name='function[$name]' onchange='functionChange(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "") . "</select>"
|
||||||
|
|
|
@ -435,6 +435,16 @@ function functionChange(select) {
|
||||||
helpClose();
|
helpClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Call this.onchange() if value changes
|
||||||
|
* @this HTMLInputElement
|
||||||
|
*/
|
||||||
|
function keyupChange() {
|
||||||
|
if (this.value != this.getAttribute('value')) {
|
||||||
|
this.onchange();
|
||||||
|
this.setAttribute('value', this.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Create AJAX request
|
/** Create AJAX request
|
||||||
|
|
Loading…
Reference in a new issue