// 802 //try { /************************************************************** ** CUSTOM parsley validators **************************************************************/ /*Example HTML and JS* */ /*Parsley.addValidator('myCustomQuantityValidator', { requirementType: ['integer','integer'], validateString: function(value, minRequirement, maxRequirement) { // value must be between minRequirement and maxRequirment. the value also mustn't be less than 1 console.log('custom validation triggered: ' + value + ' | [' + minRequirement + ',' + maxRequirement + ']'); return value >= 1 && value >= minRequirement && value <= maxRequirement; } //Error message for validator. Can also be done in BSP-Include V5/app_incl_header.htm via WECO-Textkeys (preferred) , messages: { en: 'Value should be greater or equal 1 and between %s and %s.', de: 'Der Wert muss größer oder gleich 1 sein und zwischen %s und %s liegen.' } }); Parsley.addValidator('myCustomQuantityValidator', { validateString: function (value) { console.log('custom validation triggered: ' + value); return value = /^[a-zA-Z ]+$/.test(value); } //Error message for validator. Can also be done in BSP-Include V5/app_incl_header.htm via WECO-Textkeys (preferred) , messages: { en: 'Error EN', de: 'Error DE.' } }); } catch (e) { console.log(e); } */ try { Parsley.addValidator('ccnam', { validateString: function (value) { return value = /^[a-zA-Z \xC0-\uFFFF]+$/.test(value); }, messages: { en: 'Pleae make sure not to use numbers or special characters.' } }); } catch (e) { } try { Parsley.addValidator('ccscd', { validateString: function (value) { return value = /^[0-9]{3,4}$/.test(value); }, messages: { en: 'Pleae check your entries.' } }); } catch (e) { } try { Parsley.addValidator('valtm', { validateString: function (value) { const d = new Date(); let month = d.getMonth()+1; let year = d.getFullYear(); let valty = $('select[name*="VALTY"]').val(); let choice = parseFloat(Number(valty).toString() + Number(value).toString().padStart(2, '0')); let today = parseFloat(Number(year).toString() + Number(month).toString().padStart(2, '0')); if (choice < today){ return false; } }, messages: { en: 'Pleae check validity period.' } }); } catch (e) {} try { Parsley.addValidator('valty', { validateString: function (value) { $('select[name*="VALTM"]').parsley().validate(); return true; } }); } catch (e) {}