[Vtigercrm-developers] extend Validation engine (Ajax)

Uma S uma.s at vtiger.com
Wed Feb 25 11:28:07 GMT 2015


Hi Alan,

For a field if we have data-validator attribute, then this will be used as
one of the validator for field validation and is by default triggered by
BaseVaildator.

But in your case you need to call invokeValidation static api GlobalPhoneCheck
jQuery class.

We do have similar example in vtiger open-source in file
(layouts/vlayout/modules/CustomView/resources/CustomView.js) within
registerEvents()
api, we are making call
to Vtiger_MultiSelect_Validator_Js.invokeValidation() which is defined in
FieldValidator.js.

Please refer this, hope this might help.

On Wed, Feb 25, 2015 at 3:35 PM, Alan Lord <alanslists at gmail.com> wrote:

> On 25/02/15 09:33, Uma S wrote:
>
>>
>> With regard to invokeVaidation() api, how you are calling this api?
>> Usually static api's need to called using class_name as you know :) like
>> this Vtiger_GlobalPhoneCheck_Validator_Js.invokeValidation()
>>
>>
> Thanks Uma,
>
> So how can I do this? When I add my validation to the the Field.php it
> sets the code in the field like this:
>
>  <input type="text"
>>
>     data-validator="[{"name":"GlobalPhoneCheck"}]"
>
> data-fieldinfo="{"mandatory":true,"presence":true,"quickcreate":true,"
> masseditable":true,"defaultvalue":false,"type":"
> phone","name":"phone","label":"Primary Phone"}"
>     value="830780222811"
>     name="phone"
>     data-validation-engine="validate[ required,funcCall[Vtiger_Base_
> Validator_Js.invokeValidation]]"
>     class="input-large" id="Leads_editView_fieldName_phone"
>
>>
>>
> So how can I change the classname that is set in the
> data-validation-engine attribute?
>
> Alan
>
>
> _______________________________________________
> http://www.vtiger.com/
>



-- 
With
Best Regards
Uma.S
Vtiger Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150225/6c06c14e/attachment.html>


More information about the vtigercrm-developers mailing list