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')}`);
|
||||
}
|
||||
|
||||
let unmaskedVal = val;
|
||||
if(typeof $el.inputmask === 'function'){
|
||||
unmaskedVal = $el.inputmask('unmaskedvalue');
|
||||
}
|
||||
|
||||
// required
|
||||
if (
|
||||
$el.hasClass('required') &&
|
||||
(!val.length ||
|
||||
!val.trim().length ||
|
||||
(ui.isHtml(val) && !$(val).text().length))
|
||||
(!unmaskedVal.length ||
|
||||
!unmaskedVal.trim().length ||
|
||||
(ui.isHtml(val) && !$(unmaskedVal).text().length))
|
||||
) {
|
||||
valid = false;
|
||||
console.warn(`${NAME}: Required field is missing #${$el.attr('id')}`);
|
||||
@ -76,11 +81,6 @@ const FormValidateField = (($) => {
|
||||
console.warn(`${NAME}: Wrong URL #${$el.attr('id')}`);
|
||||
}
|
||||
|
||||
let unmaskedVal = val;
|
||||
if(typeof $el.inputmask === 'function'){
|
||||
unmaskedVal = $el.inputmask('unmaskedvalue');
|
||||
}
|
||||
|
||||
// maxlength
|
||||
const maxLength = $el.attr('maxlength');
|
||||
if(maxLength && maxLength.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user