EasyUI Forum
May 19, 2024, 12:44:13 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: Form load, checkbox gets checked when value is 0  (Read 6025 times)
phunksta
Jr. Member
**
Posts: 54


View Profile Email
« on: March 13, 2015, 02:22:28 AM »

Hi,

I'm trying to chase down an issue that I had put a workaround in for, but now I'mwondering if it might be a bug?

Basically, I use $f.form('load',url) to fetch a record, which contains some checkboxes.
My source returns 0=unchecked, 1=checked for these fields.
When loaded, these checkboxes are checked when the value is zero.

It think it might be something in here:
Code:
       function _4c3(name, val) {
            var rr = $(_4c0).find("input[name=\"" + name + "\"][type=radio], input[name=\"" + name + "\"][type=checkbox]");
            rr._propAttr("checked", false);
            rr.each(function () {
                var f = $(this);
                if (f.val() == String(val) || $.inArray(f.val(), $.isArray(val) ? val : [val]) >= 0) {
                    f._propAttr("checked", true);
                }
            });
            return rr;
        };

So basically when the value is 0, then f.val() == String(val) evaluates as true.
Can you help?
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!