EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: theara on April 23, 2014, 11:59:51 PM



Title: Custom Validation Rule with php
Post by: theara on April 23, 2014, 11:59:51 PM
Dear,

I am a new client of easyui.
I would like to custom validation rule and message with php.

Pl help me with example.


Title: Re: Custom Validation Rule with php
Post by: stworthy on April 24, 2014, 01:45:18 AM
The validating works on client side(browser). To custom validate rule, override $.fn.validatebox.defaults.rules that defines a validator function and invalid message. For example, to define a minLength valid type:
Code:
$.extend($.fn.validatebox.defaults.rules, {
    minLength: {
        validator: function(value, param){
            return value.length >= param[0];
        },
        message: 'Please enter at least {0} characters.'
    }
});