mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPR: JS validate Min/max length
This commit is contained in:
parent
b175062400
commit
53befbb036
@ -56,12 +56,17 @@ const FormValidateField = (($) => {
|
|||||||
console.warn(`${NAME}: Browser check validity is failed #${$el.attr('id')}`);
|
console.warn(`${NAME}: Browser check validity is failed #${$el.attr('id')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let unmaskedVal = val;
|
||||||
|
if(typeof $el.inputmask === 'function'){
|
||||||
|
unmaskedVal = $el.inputmask('unmaskedvalue');
|
||||||
|
}
|
||||||
|
|
||||||
// required
|
// required
|
||||||
if (
|
if (
|
||||||
$el.hasClass('required') &&
|
$el.hasClass('required') &&
|
||||||
(!val.length ||
|
(!unmaskedVal.length ||
|
||||||
!val.trim().length ||
|
!unmaskedVal.trim().length ||
|
||||||
(ui.isHtml(val) && !$(val).text().length))
|
(ui.isHtml(val) && !$(unmaskedVal).text().length))
|
||||||
) {
|
) {
|
||||||
valid = false;
|
valid = false;
|
||||||
console.warn(`${NAME}: Required field is missing #${$el.attr('id')}`);
|
console.warn(`${NAME}: Required field is missing #${$el.attr('id')}`);
|
||||||
@ -76,11 +81,6 @@ const FormValidateField = (($) => {
|
|||||||
console.warn(`${NAME}: Wrong URL #${$el.attr('id')}`);
|
console.warn(`${NAME}: Wrong URL #${$el.attr('id')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let unmaskedVal = val;
|
|
||||||
if(typeof $el.inputmask === 'function'){
|
|
||||||
unmaskedVal = $el.inputmask('unmaskedvalue');
|
|
||||||
}
|
|
||||||
|
|
||||||
// maxlength
|
// maxlength
|
||||||
const maxLength = $el.attr('maxlength');
|
const maxLength = $el.attr('maxlength');
|
||||||
if(maxLength && maxLength.length) {
|
if(maxLength && maxLength.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user