]> git.joonet.de Git - adminer.git/commitdiff
Disable maxlength with edit functions
authorJakub Vrana <jakub@vrana.cz>
Fri, 18 Mar 2011 08:06:05 +0000 (09:06 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 18 Mar 2011 08:08:27 +0000 (09:08 +0100)
adminer/include/functions.inc.php
adminer/static/functions.js

index eb51e595977c4e7faeff558f51359c73d88a36f5..590600167434e7b84714e3280d8e9e590e8a08cc 100644 (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;
index 6cf09ebc3800b0b4827044d98300fd0f49b9ff97..2b9f372692e1596cbc4f84c50d213f047072bc57 100644 (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