1

Closed

checkbox not well binding (input --> model)

description

I have a checkbox :
<input id="idscreen3misesEnApplicationClient" type="checkbox" jqxb-datasource="myds" jqxb-datamember="mymember" jqxb-bindedattribute="checked" />

When i receive data with :
{ "mymember" : false ,…}
the checkbox is correctly checked.

But if i uncheck and check again the checkbox field, in the model, i not found :
{ "mymember" : false ,…}  
but :
{ "mymember" : "checked" ,…}
"checked" seem's to be return by jQXB.getValueFromAttrib function.
Closed Sep 25, 2011 at 2:24 PM by lightcode
compatibility mode now use jQuery 1.6.x as default

comments

myasic wrote Sep 22, 2011 at 1:17 PM

I patch code like that and it's worked :

jQXB.getValueFromAttrib = function (jQrjElem) {
var result = "";
var attrib = jQrjElem.attr(jQXB.JQXB_BINDEDATTRIBUTE_ATTR);
if (attrib != undefined) {
    if (attrib === "checked") { 
        if (jQrjElem.is(':checked')) {
            result = true;
        } else {
            result = false;
        }
    } else {
        result = jQrjElem.attr(attrib);
    }
} else {
    result = jQrjElem.val();
}
return result;
}

lightcode wrote Sep 22, 2011 at 3:13 PM

This issue is due to the new version of jQuery since 1.6. that changed API.
Most probably you use 1.6.x. At the moment you can use jQuery 1.4.x.
We are testing the new build of jQXB which provides a new compatibility mode in order to use jQXB with the new jQuery version ( default ) or in compatibility mode and it will be available in some days.
In addition new build provides a mechanism to execute values transformation in order to transform values just before set Html Element or just before uldate datasource.