ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

customcheck

lapo78 17 Feb, 2018
Hi,
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
GreyHead 17 Feb, 2018
Hi lapo78,

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
lapo78 17 Feb, 2018
console.log(el.errors)
lapo78 17 Feb, 2018
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.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com