Disable maxlength with edit functions

This commit is contained in:
Jakub Vrana 2011-03-18 09:06:05 +01:00
parent cdeecc3e19
commit 622845b096
2 changed files with 16 additions and 1 deletions

View file

@ -673,7 +673,7 @@ function input($field, $value, $function) {
}
$onchange = ($first ? " onchange=\"var f = this.form['function[" . js_escape($name) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
$attrs .= $onchange;
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "") : nbsp(reset($functions))) . '<td>';
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
if ($input != "") {
echo $input;

View file

@ -220,6 +220,21 @@ function editingKeydown(event) {
return true;
}
/** Disable maxlength for functions
* @param HTMLSelectElement
*/
function functionChange(select) {
var input = select.form[select.name.replace(/^function/, 'fields')];
if (selectValue(select)) {
if (input.origMaxLength === undefined) {
input.origMaxLength = input.maxLength;
}
input.removeAttribute('maxlength');
} else if (input.origMaxLength >= 0) {
input.maxLength = input.origMaxLength;
}
}
/** Create AJAX request