]> git.joonet.de Git - adminer.git/commitdiff
Respect NOT NULL in onchange
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 9 Oct 2008 12:24:43 +0000 (12:24 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 9 Oct 2008 12:24:43 +0000 (12:24 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@525 7c3ca157-0c34-0410-bff1-cbf682f78f5c

editing.inc.php

index 295ada11096a597a36c1bf26766f0db773d6ca4e..f3dd183cba1c8fe543e270ba16ada1780ff0785b 100644 (file)
@@ -19,8 +19,8 @@ function input($name, $field, $value) {
                        echo ' <label><input type="radio" name="fields[' . $name . ']" value="' . (isset($_GET["default"]) ? (strlen($val) ? htmlspecialchars($val) : " ") : $i+1) . '"' . ($checked ? ' checked="checked"' : '') . ' />' . htmlspecialchars($val) . '</label>';
                }
        } else {
-               $first = (isset($_GET["select"]) ? 2 : 1);
-               $onchange = ($field["null"] || isset($_GET["select"]) ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; f.selectedIndex = Math.max(f.selectedIndex, ' . $first . ');"' : '');
+               $first = $field["null"] + isset($_GET["select"]);
+               $onchange = ($first ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; if (' . $first . ' > f.selectedIndex) f.selectedIndex = ' . $first . ';"' : '');
                $options = array("");
                if (!isset($_GET["default"]) && preg_match('~char|date|time~', $field["type"])) {
                        $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now"));