:: Forum >>
How to revert the readonly attribute on an input box?
I am able to set the readonly property for an input ui control. I need to make it read-write on a button click (on an event). I am unable to revert it back.
Can somebody help me on this? Please treat this as an urgent request. I think this a very primitive requirement and I think I am missing something here. Below is the sample code:
var obj = new AW.UI.Input;
obj.setId("myInput");
obj.setAttribute("disabled","true");
obj.getContent('box/text').setAttribute('readonly', 'readonly');
obj.setControlText("Some text");
document.write(obj);
var button1 = new AW.UI.Button;
button1.setControlSize(90);
button1.setControlText("Enable edit");
button1.onControlClicked = function(event){
obj.setAttribute("disabled",null);
obj.getContent('box/text').setAttribute('readonly','');
obj.refresh();
}
document.write(button1);
--thank you
Prasad
Wednesday, July 26, 2006
try
obj.getContent('box/text').setAttribute('readonly', null);
Bryn
Wednesday, July 26, 2006
Hi Bryn!
Thank you for the response. I am using 2.0.1 version of AW. I tried the above mentioned, but I am unsucessful in reverting the readonly attribute. Can you please let me know where I am going?
Can anyone please help me?
--thanks and regards
Prasad
Wednesday, July 26, 2006
There is a bug in child html caching in AW controls. To make your code working you need to clear internal _innerHTML and _outerHTML properties -
button1.onControlClicked = function(event){
obj.setAttribute("disabled",null);
obj.getContent('box/text').setAttribute('readonly','');
obj.getContent('box')._outerHTML = "";
obj.getContent('box')._innerHTML = "";
obj._outerHTML = "";
obj._innerHTML = "";
obj.refresh();
}
:-(
Alex (ActiveWidgets)
Wednesday, July 26, 2006
Thanks Alex. It's working
Prasad
Friday, July 28, 2006
This topic is archived.
Back to support forum
Forum search