EasyUI Forum
May 20, 2024, 04:08:32 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Custom Validation Rule with php  (Read 5450 times)
theara
Newbie
*
Posts: 1


View Profile
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.'
    }
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!