[Vtigercrm-developers] Examples of extending Vtiger_BaseValidator_Js

Uma S uma.s at vtiger.com
Fri Sep 5 17:19:15 GMT 2014


Hi Alan,

To add any custom validator for a field, We are adding one special data
attribute(data-validator). The validator name that is specified will be
described in javascript related to the module. When validation is triggered
on any field. First validation will be triggered based on type of field
then on data-validator of a field.

*Example:*

Please look at
1> AddFolder.tpl (layouts/vlayout/modules/Documents), Where input element
with name="foldername" has data-validator as FolderName.

2> Which is defined in List.js
(layouts/vlayout/modules/Documents/resources) which will be triggered on
foldername validation on Add folder of Documents module.


On Fri, Sep 5, 2014 at 8:51 PM, Alan Lord (News) <alanslists at gmail.com>
wrote:

> I'd like to understand how to correctly emulate or extend the
> Vtiger_Base_Validator classes within my module so as to make use of as much
> common functionality as possible...
>
> I have two fields in a Settings screen that I would like to apply a custom
> validation rule to (basically to test if it is a valid Latitude,Longitude
> coordinate pair).
>
> I have the regex for my test, but am finding it hard to work out the right
> syntax to enter in the fields to trigger the validation and how to address
> my LatLngValidator.js class and where it should reside?
>
>
> Thanks
>
> Al
>
>
> --
> Libertus Solutions
> http://www.libertus.co.uk
>
> _______________________________________________
> 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/20140905/890e8577/attachment.html>


More information about the vtigercrm-developers mailing list