3.2.0

Making AW.UI.Input readonly, problems with Firefox 3

I need to make input fields "readonly" then after an event such as clicking a button, I need to be able to edit the field.

This sample code works fine on IE 6.0 but not in Firefox.

Alex, is this a bug? I'm using version 2.5.2 thanks!

--------------SAMPLE CODE--------------------
<script src="runtime/lib/aw.js"></script>
<link rel="stylesheet" href="runtime/styles/xp/aw.css"></link>

<style>
#STRING { left:20px; top:20px; width:200px; height:20px; }
#BUTTON1 { left:50px; top:20px; width:100px; height:20px; }
#BUTTON2 { left:80px; top:20px; width:100px; height:20px; }
</style>

<script type="text/javascript">

var STRING = new AW.UI.Input;
STRING.setId("STRING");
STRING.setStyle("background-color","#ece9d8");
STRING.getContent('box/text').setAttribute('readOnly','readOnly');
STRING.getContent('box/text').setAttribute('MAXLENGTH','50');
STRING.setControlText("edit this text");
document.write(STRING);

var BUTTON1 = new AW.UI.Button;
BUTTON1.setId("BUTTON1");
BUTTON1.setControlText("Edit");
document.write(BUTTON1);

BUTTON1.onControlClicked = function(){
STRING.setStyle("background-color","#FFFFFF");
STRING.getContent('box/text').setAttribute('readOnly',null);
}

var BUTTON2 = new AW.UI.Button;
BUTTON2.setId("BUTTON2");
BUTTON2.setControlText("lock");
document.write(BUTTON2);

BUTTON2.onControlClicked = function(){
STRING.setStyle("background-color","#ece9d8");
STRING.getContent('box/text').setAttribute('readOnly','readOnly');
}

</script>
Javi
October 8,
I discovered that Firefox 3.0.3 only works with 'readonly'.
IE works only works with 'readOnly'. Case matters.

So to fix my application I had to first test for Firefox and make the adjustment.

example:
var browser = navigator.userAgent;
if(browser.match("Firefox"))
{ STRING.getContent('box/text').setAttribute('readonly','readonly'); }
Javi
October 22,

This topic is archived.

See also:


Back to support forum