EasyUI Forum
July 17, 2018, 08:08:40 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: validate box for 2 numbers  (Read 127 times)
crosemffet
Jr. Member
**
Posts: 66



View Profile WWW Email
« on: June 04, 2018, 03:04:21 PM »

hello, and thanks in advance for your support.
I have 2 field numbers:
<input class="easyui-numberbox" id="bet" name="bet" value="">
<input class="easyui-numberbox" id="price" name="price" value="" validType="greaterThan['#bet']">
I need to extend the validate box to check than price is greater than bet.
That's what I'm doing:
$.extend($.fn.validatebox.defaults.rules, {
    greaterThan: {
        validator: function(value,param){
            return number(value) > number($(param[0]).val());
        },
        message: 'Price must be greater than bet.'
    }
});
not working.
what's wrong?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3295


View Profile Email
« Reply #1 on: June 04, 2018, 07:28:36 PM »

Try this code instead.
Code:
$.extend($.fn.validatebox.defaults.rules, {
    greaterThan: {
        validator: function(value,param){
            return parseInt(value) > parseInt($(param[0]).numberbox('getValue'));
        },
        message: 'Price must be greater than bet.'
    }
});
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!