EasyUI Forum

General Category => Bug Report => Topic started by: phunksta on March 13, 2015, 02:22:28 AM



Title: Form load, checkbox gets checked when value is 0
Post by: phunksta 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?