Truncate maxlength= fields (#189)

This commit is contained in:
Erayd
2019-10-31 12:38:45 +13:00
committed by GitHub
parent 87eb6e0156
commit 6b04258ef4

View File

@@ -411,6 +411,11 @@
el.dispatchEvent(new Event(eventName, { bubbles: true }));
}
// truncate the value if required by the field
if (el.maxLength > 0) {
value = value.substr(0, el.maxLength);
}
// Set the field value
let initialValue = el.value || el.getAttribute("value");
el.setAttribute("value", value);