checkbox : when click on change

Hi,

I have one question in the form of the checkbox. When I click the name or description of checkbox, the sym of “click” will appear or disappear. Now I want to click the name or description that no any action, I click the checkbox that it can change the sym of “click”. How can do it.

thank you very much.

Kenneth Cho

Hi,

I find the solution in there.
http://forum.dhtmlx.com/viewtopic.php?f=17&t=39290

But I want to when I click the label it can do an action, I click the checkbox do another action.

Could you help.

many thanks again.

Kenneth Cho

Hi

please specify exact action you need?

Hi,

Thanks for your reoly, my action as below.
I have a layout, LHS is a form, RHS is a tree, when I ckick the label of a form in LHS, it will show the tree in RHS.

Many thanks again.

Kenneth Cho

Hi

add override once dhtmlx.js is loaded:

[code]dhtmlXForm.prototype.items.checkbox.doAttachEvents = function(item) {
var that = this;
// image click
item.childNodes[item._ll?1:0][window.dhx4.isIPad?“ontouchstart”:“onmousedown”] = function(e) {
e = e||event;
if (e.preventDefault) e.preventDefault();
var t = (e.target||e.srcElement); // need to skip “note” if exists
if (!this.parentNode._enabled || this.parentNode._ro || (typeof(t.className) != “undefined” && t.className == “dhxform_note”)) {
e.cancelBubble = true;
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
that.doClick(this.parentNode, “img”);
}
// label click
item.childNodes[item._ll?0:1].childNodes[0][window.dhx4.isIPad?“ontouchstart”:“onmousedown”] = function(e) {
e = e||event;
if (e.preventDefault) e.preventDefault();
// do not check if r/o here, allow item’s be highlighted, check for r/o added into doClick
if (!this.parentNode.parentNode._enabled) {
e.cancelBubble = true;
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
// check if “info” clicked (checkbox/radio only)
var t = e.target||e.srcElement;
if (typeof(t.className) != “undefined” && t.className == “dhxform_info”) {
this.parentNode.parentNode.callEvent(“onInfo”,[this.parentNode.parentNode._idd, e]);
e.cancelBubble = true;
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
that.doClick(this.parentNode.parentNode, “label”);
}
};

dhtmlXForm.prototype.items.checkbox.doClick = function(item, type) {

item.childNodes[item._ll?0:1].childNodes[0].focus();

if (!item._enabled || item._ro) return;

if (item.checkEvent("onBeforeChange")) if (item.callEvent("onBeforeChange", [item._idd, item._value, item._checked, type]) !== true) return;

this.setChecked(item, !item._checked);
item._autoCheck();
item.callEvent("onChange", [item._idd, item._value, item._checked, type]);

};[/code]

then in code:

myForm.attachEvent("onBeforeChange", function(id, value, checked, type){ if (type == "label") { // label click return false; } return true; });

It worked,

thank you very my again. :laughing: :laughing: