PDA

View Full Version : WHen i click the fieldlabel of the checkbox, the box will be checked/unchecked?



safewolf
30 Dec 2010, 7:59 AM
Hi, everyone

How can i disable this feature?

I don't want to allow user to check/uncheck the box by clicking the field label

i want to force them to click the box to check/uncheck

Condor
30 Dec 2010, 8:43 AM
You would have to remove the 'for' attribute from the label after it is rendered.

safewolf
3 Jan 2011, 6:03 PM
Sorry

but, how to remove the 'for' attribute?

Condor
3 Jan 2011, 11:28 PM
{
xtype: 'checkbox',
fieldLabel: 'My fieldLabel',
boxLabel: 'My boxLabel',
listeners: {
render: function(cb) {
var fieldLabelEl = this.label // Ext 3
|| this.wrap.up('.x-form-item').child('.x-form-item-label'); // Ext 2
fieldLabelEl.removeAttribute('htmlFor');
var boxLabelEl = this.wrap.child('.x-form-cb-label');
boxLabelEl.removeAttribute('htmlFor');
}
}
}