473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Forecolor of disabled controls


How could I use the color black rather the default grey?

--
iTech Consulting Co., Ltd.
Specialized in providing ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852) 2325 3883 Fax: (852)2325 8288
Feb 16 '07 #1
5 9606
On 2007-02-16, Man-wai Chang <to***********@gmail.comwrote:
>
How could I use the color black rather the default grey?
You can't control things like that (except possibly in CSS 3, which some
browsers support bits of).

An option is to write your own controls out of images etc. and
Javascript. Or better just get used to the default grey :)
Feb 16 '07 #2
Scripsit Ben C:
On 2007-02-16, Man-wai Chang <to***********@gmail.comwrote:
>>
How could I use the color black rather the default grey?

You can't control things like that (except possibly in CSS 3, which
some browsers support bits of).
That seems to be the case. Explicitly setting the color works for a normal
text input field but not for a disabled text input field. I first thought it
might relate to degree opacity, in which case CSS 3 might indeed have
something to offer, but setting the color, say, to red does not turn it to
pale red. Instead, the browser uses its own shade of grey, as if the style
sheet were not there.
An option is to write your own controls out of images etc. and
Javascript. Or better just get used to the default grey :)
Or best just get rid of disabled controls. What's the point anyway? Why
would you show the user something that looks somewhat like a form field but
does not get submitted along with a form (and cannot be modified).

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 16 '07 #3
Scripsit Jukka K. Korpela:
>>How could I use the color black rather the default grey?

You can't control things like that (except possibly in CSS 3, which
some browsers support bits of).

That seems to be the case. Explicitly setting the color works for a
normal text input field but not for a disabled text input field.
Correction: That's true for IE up to and including IE 7, but Firefox seems
to have no restrictions in this respect. I don't know why you would use a
different color for a disabled field, but if you do, you might consider
using the CSS 3 property opacity as well, to give a visual message of the
disabled state. E.g.,

<input type="text" name="foo" value="bar" disabled
style="color: red; background: white; opacity: 0.5">

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 16 '07 #4
"Jukka K. Korpela" <jk******@cs.tut.fiwrites:
Or best just get rid of disabled controls. What's the point anyway?
Why would you show the user something that looks somewhat like a form
field but does not get submitted along with a form (and cannot be
modified).
I agree that writing the disabling into the HTML is pointless, but not
that being able to disable a control necessarily is.

....
<input type='checkbox' name='q4' value='other'Other (please state)
<input name='q4other' size='40'>
....

It might be a reasonable optional enhancement to this form to use
Javascript to initially set the 'other' <inputto be disabled (which
obviously can't be set as an initial state in the HTML), and then
enable and disable this as the relevant checkbox is used. Similarly
for complex data-collection requirements (e.g. checkbox F is only
available if two or more of checkboxes A, B and C are selected) where
it might help the user's mental model of the data. All optional and
backed up by the same logic server-side, naturally.

Whether this is more or less usable than modifying q4other's display
style between inline and none I'm not sure - I'd have to try both out.

--
Chris
Feb 16 '07 #5
Scripsit Chris Morris:
<input type='checkbox' name='q4' value='other'Other (please state)
<input name='q4other' size='40'>
...

It might be a reasonable optional enhancement to this form to use
Javascript to initially set the 'other' <inputto be disabled (which
obviously can't be set as an initial state in the HTML), and then
enable and disable this as the relevant checkbox is used.
It's better to do that by setting visibility to hidden in JavaScript
initially.
Whether this is more or less usable than modifying q4other's display
style between inline and none I'm not sure - I'd have to try both out.
Setting display to none avoids the rendering issues with disabled controls
and causes less confusion, since the user won't see the text input field
until it is needed and will automatically see it as a normal field when
needed.

But setting visibility to hidden avoids the redraw problem. If you change an
element's display property, the page will generally need to be reformatted
(redrawn) as a whole, whereas toggling visibility affects the particular
element only, since space has been allocated for it anyway.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mantorok | last post by:
Hi all Is it possible to disable a Control in .Net but have the text colour always in black? I would rather use Enabled property rather than Readonly as it does everything I need it to in one...
3
by: Steve Le Monnier | last post by:
When you make a textbox control disabled ( txtText1.Enabled = false; ) You're left with grey text on a greyer background, which is not ideal. The Read-Only property is no use to me as I need to...
6
by: Stu Carter | last post by:
Hi, I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. ...
9
by: Max Weebler | last post by:
Hi, I have a datagrid built that has an alternating item style that sets the backcolor and ForeColor of its rows. I have 4 template columns. One of them has a LinkButton embedded in it to...
3
by: Eric Moreau | last post by:
Hi I have a user that is visually impaired and who cannot read textboxes content when they are disabled. I have tried to inherits from the Textbox and overwrite the Paint method but I have...
2
by: Agnes | last post by:
my client complaint that "when the textbox is disabled, the forecolor is too light ". How can I change it ? Thanks a lot
0
by: Jeff | last post by:
in VB.net with Visual Studio 2005 is there a way to alter the forecolor on a listbox or other asp control when the control is disabled? ....easy to do for the enabled colors, but I can't find...
4
by: Allan Ebdrup | last post by:
When I set the forecolor of a linkbutton to red after setting enabled to false, the linkbutton stays grey? How do I change the appearance of a disabled linkbutton? Kind Regards, Allan Ebdrup
17
by: govolsbaby | last post by:
Is there a way to leave the button forecolor unchanged when it is disabled? I have multiple buttons on the form and depending on various user inputs, some will or will not be enabled but I'd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.