combo control: how to disable editing
i am using the following standalone combo control as a color picker, and wondering how to :
1. disable the editing of the text, and
2. disable the dropdown/ the whole control (depending on some conditions)
here is the code:
<style>
.aw-image-black {background-color: #000000;}
.aw-image-blue {background-color: #0000FF;}
.aw-image-green {background-color: #00FF00;}
.aw-image-red {background-color: #FF0000;}
.aw-image-yellow {background-color: #FFFF00;}
.aw-image-white {background-color: #FFFFFF;}
#myColors .aw-item-image, #myColors-popup .aw-item-image {
border: 3px solid #fff;
}
</style>
<script>
var colorsText = ["Black", "Blue", "Green", "Red", "Yellow", "White"];
var colorsImage = ["black", "blue", "green", "red", "yellow", "white"];
var obj = new AW.UI.Combo;
obj.setId("myColors");
obj.setItemText(colorsText);
obj.setItemImage(colorsImage);
obj.setItemCount(6);
// cannot get it to work! also tried setAttribute('readOnly', 'readOnly')
if (some condition)
obj.setAttribute('readOnly','true');
document.write(obj);
// update textbox image
obj.onSelectedItemsChanged = function(items){
this.setTimeout(function(){
this.setControlImage(this.getItemImage(items[0]));
});
}
// can't get this to work either!
obj.onControlEditStarted = function() {
this.getContent("box/text").element().contentEditable = false;
}
</script>
am i doing something wrong? thank you for any help!
1. disable the editing of the text, and
2. disable the dropdown/ the whole control (depending on some conditions)
here is the code:
<style>
.aw-image-black {background-color: #000000;}
.aw-image-blue {background-color: #0000FF;}
.aw-image-green {background-color: #00FF00;}
.aw-image-red {background-color: #FF0000;}
.aw-image-yellow {background-color: #FFFF00;}
.aw-image-white {background-color: #FFFFFF;}
#myColors .aw-item-image, #myColors-popup .aw-item-image {
border: 3px solid #fff;
}
</style>
<script>
var colorsText = ["Black", "Blue", "Green", "Red", "Yellow", "White"];
var colorsImage = ["black", "blue", "green", "red", "yellow", "white"];
var obj = new AW.UI.Combo;
obj.setId("myColors");
obj.setItemText(colorsText);
obj.setItemImage(colorsImage);
obj.setItemCount(6);
// cannot get it to work! also tried setAttribute('readOnly', 'readOnly')
if (some condition)
obj.setAttribute('readOnly','true');
document.write(obj);
// update textbox image
obj.onSelectedItemsChanged = function(items){
this.setTimeout(function(){
this.setControlImage(this.getItemImage(items[0]));
});
}
// can't get this to work either!
obj.onControlEditStarted = function() {
this.getContent("box/text").element().contentEditable = false;
}
</script>
am i doing something wrong? thank you for any help!
heidit
August 14,