TIWCGJQValidateOptions.AddMethod(string,string,string,boolean) Method

Procedure allow to add the custom methods of validations.

Namespace: IWCGJQControl
public
 procedure AddMethod(const AMethodName, AFuncJS: string; AErrorMsg: string; const AErrorMsgFunc: boolean = False); overload;

Parameters

AMethodName
Type: string

The method name

Note

You need to set the TIWCGJQValidateOptionsRule.CustomRule property with the method name.

AFuncJS
Type: string

Javascript function.

Example of method of minWord validator:

function(value, element, params) {
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
}

AErrorMsg
Type: string

The default message to display for this method.

AErrorMsgFunc
Type: boolean

Set this parameter to true, if you want to pass as javascript code.