WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 CSS of Disabled SELECT, why ????, Moshe, June 21, 2005
     Re:CSS of Disabled SELECT, why ????, Erik Arvidsson, July 16, 2005
     Re:CSS of Disabled SELECT, why ????, phil, June 28, 2005
         Re:CSS of Disabled SELECT, why ????, Moshe, June 30, 2005
             Re:CSS of Disabled SELECT, why ????, Moshe, June 30, 2005

Subject: Re:CSS of Disabled SELECT, why ???? From: Moshe Date: June 30, 2005

contentEditable doesn't have any effect on <select> element. it is not editable in any case...

but thanks for the sugegstion.

From: phil
Sent: June 28, 2005
Subject: Re:CSS of Disabled SELECT, why ????

how about just setting contentEditable="false" and setting the backgroundColor = "menu"?

From: Moshe
Sent: June 21, 2005
Subject: Re:CSS of Disabled SELECT, why ????

I'm working on a very complex GUI based on JS, JSP, CSS and HTML.

In some cases it is required to display fields in a "read-only" mode, though, I want it "read-only" and not "disabled".

When "disabled=true" is used, the text gets specific hard coded properties that I do not wish to have.

And so, in the case of INPUT fields, I can use :"readonly" and problem solved.

The problem I have is with "SELECT" fields, in which readonly is meaningless.

I came up with the below solution, though, it is ugly and in some cases doesn't even do the job right, I will appriciate any comments on this (btw -  development is for IE6+ only).

---------------------------------------------------------------------------

<html>
<head>
<title></title>
<script language="javascript">
<!--
function blurField (e)
  {
   var obj = e.srcElement;
    obj.blur();
    obj.document.body.setActive();
    obj.document.body.focus();
  }
//-->
</script>
</head>

<body style="background-color:buttonface">
Expected result:<br>
<select  readonly='true' onmousemove='blurField(event);' onfocus='blurField(event);' onkeydown='event.returnValue = false;return false;' style="background-color:buttonface">
 <option> value 1</option>
 <option> value 2</option>
 <option> value 3</option>
 <option> value 4</option>
 <option> value 5</option>
 <option> value 6</option>
 <option> value 7</option>
</select>
<br>
Odd IE implementation :<br>
<select  disabled="true">
 <option> value 1</option>
 <option> value 2</option>
 <option> value 3</option>
 <option> value 4</option>
 <option> value 5</option>
 <option> value 6</option>
 <option> value 7</option>
</select>
</body>
</html>






Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX