mirror of
https://github.com/vrana/adminer.git
synced 2025-08-26 15:54:34 +02:00
Make maxlength in edit fields a soft limit
This commit is contained in:
@@ -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; }
|
||||
|
@@ -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
|
||||
};
|
||||
|
Reference in New Issue
Block a user