EasyUI Forum
September 14, 2025, 05:55:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to repeatedly check input value  (Read 12896 times)
mars610
Newbie
*
Posts: 13


View Profile Email
« on: March 19, 2012, 07:52:51 AM »

There is an example: a datebox 'A' and the other datebox 'B', i want to check datebox 'A' value is later than today and is  later than value of databox 'B'.

Code snippets:
$.extend($.fn.validatebox.defaults.rules, { 
    isAfter: { 
        validator: function(value, param){ 
           ......; 
        }, 
        message: '......' 
    } ,
    isLaterToday: { 
        validator: function(value, param){ 
           ......; 
        }, 
        message: '......' 
    }
}); 

HTML:
<input id="A" class="easyui-datebox" validType=""/>
<input id="B" class="easyui-datebox" />
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 19, 2012, 08:36:48 PM »

The JavaScript Code:
Code:
$.extend($.fn.validatebox.defaults.rules, { 
    isAfter: {
        validator: function(value, param){
var dateA = $.fn.datebox.defaults.parser(value);
var dateB = $.fn.datebox.defaults.parser($(param[0]).datebox('getValue'));
return dateA>new Date() && dateA>dateB;
        },
        message: 'The date is not later than today and B'
    } ,
    isLaterToday: {
        validator: function(value, param){
var date = $.fn.datebox.defaults.parser(value);
return date>new Date();
        },
        message: 'The date is not later than today'
    }
});

The HTML Code:
Code:
<input id="A" class="easyui-datebox" validType="isAfter['#B']"/>
<input id="B" class="easyui-datebox" validType="isLaterToday"/>
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!