diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 42e780e9..5f6e6d8a 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -914,7 +914,7 @@ function input($field, $value, $function) { // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator echo " 20 ? " size='40'" : "") . "$attrs>" ; diff --git a/adminer/static/default.css b/adminer/static/default.css index 63f5b93c..39ce6e06 100644 --- a/adminer/static/default.css +++ b/adminer/static/default.css @@ -26,6 +26,7 @@ pre, textarea { font: 100%/1.25 monospace; } input[type=image] { vertical-align: middle; } input.default { box-shadow: 1px 1px 1px #777; } input.required { box-shadow: 1px 1px 1px red; } +input.maxlength { box-shadow: 1px 1px 1px red; } .block { display: block; } .version { color: #777; font-size: 67%; } .js .hidden, .nojs .jsonly { display: none; } diff --git a/adminer/static/functions.js b/adminer/static/functions.js index f7c048d1..71065313 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -460,16 +460,17 @@ function functionChange(select) { if (selectValue(select)) { if (input.origType === undefined) { input.origType = input.type; - input.origMaxLength = input.maxLength; + input.origMaxLength = input.getAttribute('data-maxlength'); } - input.removeAttribute('maxlength'); + input.removeAttribute('data-maxlength'); input.type = 'text'; } else if (input.origType) { input.type = input.origType; if (input.origMaxLength >= 0) { - input.maxLength = input.origMaxLength; + input.setAttribute('data-maxlength', input.origMaxLength); } } + oninput({target: input}); helpClose(); } @@ -793,3 +794,9 @@ function cloneNode(el) { setupSubmitHighlight(el2); return el2; } + +oninput = function (event) { + var target = event.target; + var maxLength = target.getAttribute('data-maxlength'); + alterClass(target, 'maxlength', target.value && maxLength != null && target.value.length > maxLength); // maxLength could be 0 +}; diff --git a/changes.txt b/changes.txt index 59f041db..dde42ec9 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 4.2.6-dev: Add accessibility labels to Create Table fields +Make maxlength in edit fields a soft limit Adminer 4.2.5 (released 2016-06-01): Fix remote execution in SQLite query