[Vtigercrm-developers] Field Validator classes? [SOLVED]

nilay khatri nilay.spartan at gmail.com
Mon Apr 9 10:29:18 GMT 2018


I guess we can even override the validation for specific modules,

getModuleSpecificValidatorClassName : function(validatorName) {		var
moduleName = app.getModuleName();		var moduleSpecificClassName =
moduleName + '_' + validatorName + '_Validator';		return
moduleSpecificClassName;	},



On Mon, Apr 9, 2018 at 3:41 PM, Alan Lord <alanslists at gmail.com> wrote:

> Just FYI in case this helps someone else.
>
> It is possible:
>
>     /**
>>      * Override validator(s) in layouts/v7/modules/Vtiger/reso
>> urces/validation.js
>>     **/
>>     setValidators : function() {
>>         jQuery.validator.methods.phone = function(value, element, params)
>> {
>>                     try {
>>                             if(!value) return true;
>>                             if(value == 0) return true;
>>                             var tenDigitRegex = /(^[0-9]{10})$/ ;
>>                             var result = tenDigitRegex.test(value);
>>                             if (!result) {
>>                                     return false;
>>                             }
>>                             return true;
>>                     } catch(err) {
>>                             console.log(err);
>>                             return false;
>>                     }
>>         }, jQuery.validator.messages.phone = app.vtranslate('Number must
>> be 10 digits only');
>>     },
>>
>
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20180409/542da7da/attachment.html>


More information about the vtigercrm-developers mailing list