View Full Version : Change radio boxLabel value after rendering?

12 Nov 2009, 7:31 AM
Hi, have a tricky problem. I need to be able to change the value of a radio component's boxLabel dynamically. I have tried calling .doLayout() on the FormPanel container but it just won't update the value of the radio components boxLabel.

Have looked through the API and there doesnt seem to be a property or public method I can use to modify the value of the boxLabel once rendered.

Is there a way to access the underlying HTML element and thus change the label parameter?

Ideas welcome! :)


12 Nov 2009, 8:37 AM
Ext.getCmp('radioButton').labelEl.dom.innerHTML = 'new box label';

12 Nov 2009, 8:46 AM
hi, tried that and Firebug throws and error:

Ext.getCmp("test2").labelEl is undefined

Ext.getCmp('test2').labelEl.dom.innerHTML = 'new box label';\r\n

12 Nov 2009, 9:11 AM
thanks for the clue, your line of code works fine for "fieldLabel", "boxLabel" however located much deeper. I was able to modify by doing:

document.getElementById(Ext.getCmp('test2').container.up('div.x-form-item').id).childNodes[1].childNodes[0].childNodes[1].innerHTML = 'finally';