Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Respect NOT NULL in onchange

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@525 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit b8ff2dfa6eeac3e65f308f62ac2f3d52ab82d09e 1 parent 644e3d7
jakubvrana authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 editing.inc.php
View
4 editing.inc.php
@@ -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"));
Please sign in to comment.
Something went wrong with that request. Please try again.