Hi,
i've this custm check
It works if field is "no", alert works if el.value match with regexp, but error.push doesn't work.
thanks
i've this custm check
function customCheck(el){
var field= jQuery('input[name=field_name]:checked').val();
if (field === 'no') {
if ( !el.value.test(/[^.*]/) ) {
alert('required '+el.value);
el.errors.push("required");
return false;
} else {
return true;
}
}
}It works if field is "no", alert works if el.value match with regexp, but error.push doesn't work.
thanks
Hi lapo78,
Please try single quotes in
Bob
Please try single quotes in
el.errors.push('required');If that does not help then you can use console.log(el.errors) to see exactly what is - or is not- being added to the errors list.
Bob
with console.log(el.errors):
["required"]0: "required"length: 1__proto__: Array(0)$constructor: ƒ Array()$family: ƒ ()append: ƒ (b)associate: ƒ (b)average: ƒ ()clean: ƒ ()clone: ƒ ()combine: ƒ (b)contains: ƒ (b,a)each: ƒ (b,a)empty: ƒ ()erase: ƒ (b)flatten: ƒ ()getLast: ƒ ()getRandom: ƒ ()hexToRgb: ƒ (b)hsbToRgb: ƒ ()include: ƒ (b)invoke: ƒ (b)link: ƒ (b)max: ƒ ()min: ƒ ()pick: ƒ ()rgbToHex: ƒ (b)rgbToHsb: ƒ ()shuffle: ƒ ()sum: ƒ ()unique: ƒ ()concat: ƒ concat()constructor: ƒ Array()copyWithin: ƒ copyWithin()entries: ƒ entries()every: ƒ every()fill: ƒ fill()filter: ƒ filter()find: ƒ find()findIndex: ƒ findIndex()forEach: ƒ forEach()includes: ƒ includes()indexOf: ƒ indexOf()join: ƒ join()keys: ƒ keys()lastIndexOf: ƒ lastIndexOf()length: 0map: ƒ map()pop: ƒ pop()push: ƒ push()reduce: ƒ reduce()reduceRight: ƒ reduceRight()reverse: ƒ reverse()shift: ƒ shift()slice: ƒ slice()some: ƒ some()sort: ƒ sort()splice: ƒ splice()toLocaleString: ƒ toLocaleString()toString: ƒ toString()unshift: ƒ unshift()Symbol(Symbol.iterator): ƒ values()Symbol(Symbol.unscopables): {copyWithin: true, entries: true, fill: true, find: true, findIndex: true, …}__proto__: Object
This topic is locked and no more replies can be posted.
