By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,822 Members | 729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,822 IT Pros & Developers. It's quick & easy.

Disabled

P: n/a
Hello,

I would like to change the look of disabled inputs of type text on my
web site.

Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
.... not using an ID or a class ...

Thanks,
Miguel
Nov 4 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
On 2008-11-04, shapper <md*****@gmail.comwrote:
Hello,

I would like to change the look of disabled inputs of type text on my
web site.

Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
... not using an ID or a class ...
There's a :disabled pseudo-selector, but it's CSS 3. You could try and
it see if it works.
Nov 4 '08 #2

P: n/a
On Nov 4, 7:51*pm, Ben C <spams...@spam.eggswrote:
On 2008-11-04, shapper <mdmo...@gmail.comwrote:
Hello,
I would like to change the look of disabled inputs of type text on my
web site.
Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
... not using an ID or a class ...

There's a :disabled pseudo-selector, but it's CSS 3. You could try and
it see if it works.
I need to work in IE6, FF2, Opera 8, ...

I think in this case, probably adding a Disabled class might be the
better solution.

Thanks,
Miguel
Nov 4 '08 #3

P: n/a
shapper schrieb:
I would like to change the look of disabled inputs of type text on my
web site.
You want to select input elements with type attribute value "text" and
disabled _attribute_ value "disabled"? So you could use the _________
selector.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Nov 4 '08 #4

P: n/a
Ben C wrote:
There's a :disabled pseudo-selector, but it's CSS 3.
That is, it is part of a sketchy draft for a proposal, formally in
"progress", practically more or less stuck, though partly implemented,
sloppily and in incompatible ways.
You could try and it see if it works.
Or you could check http://www.quirksmode.org/css/contents.html and quickly
see that there is no support in any version of IE, including IE 8 beta.

Johannes Koch alluded to use of input[disabled] which is part of "CSS 2" and
is supported by advanced browsers as well as (in "standards" mode) in IE 7.

It's still poor coverage of course. For good browser support, you would need
to use class attributes, either on the input elements or, if they appear in
groups, on containers (like div or fieldset) so that you can use a suitable
contextual selector like
..disabled input { ... }
(for, say, <div class="disabled">...</divwhere all <inputelements inside
it are disabled).

But what's the point of using an input field that cannot be used for input?
There's usually a better approach, with better styling possibilities
together with other benefits. (It's impossible to suggest a specific
approach without knowing the specific original problem that disabled fields
were supposed to solve.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Nov 4 '08 #5

P: n/a
Jukka K. Korpela schrieb:
But what's the point of using an input field that cannot be used for input?
Think of a "Save" button that is disabled as long as the text field for
the filename is empty. Or of an input field that is only meaningful if
e.g. a checkbox is selected. Yes, there are other ways, but this is
standard GUI stuff, I think
Nov 5 '08 #6

P: n/a
On Nov 5, 9:36*am, Christian Kirsch <c...@bru6.dewrote:
Jukka K. Korpela schrieb:
But what's the point of using an input field that cannot be used for input?

Think of a "Save" button that is disabled as long as the text field for
the filename is empty. Or of an input field that is only meaningful if
e.g. a checkbox is selected. Yes, there are other ways, but this is
standard GUI stuff, I think
The case here is that I have 3 forms: Create, Edit and Delete.
In Create form all items can be changed.
In Edit form a few items cannot be changed like username, ...
In Delete form all items are blocked. The inputs only show info on the
user before the user is deleted if that's the intention.

Thanks,
Miguel
Nov 5 '08 #7

P: n/a
shapper schrieb:
On Nov 5, 9:36 am, Christian Kirsch <c...@bru6.dewrote:
>Jukka K. Korpela schrieb:
>>But what's the point of using an input field that cannot be used for input?
Think of a "Save" button that is disabled as long as the text field for
the filename is empty. Or of an input field that is only meaningful if
e.g. a checkbox is selected. Yes, there are other ways, but this is
standard GUI stuff, I think

The case here is that I have 3 forms: Create, Edit and Delete.
In Create form all items can be changed.
In Edit form a few items cannot be changed like username, ...
In Delete form all items are blocked. The inputs only show info on the
user before the user is deleted if that's the intention.
Then Jukka is indeed right: What's the point of having input elements in
a form that are never enabled? Disabled elements should give the user an
indication that thy *might* be possibly enabled under certain
circumstances. This is apparently not the case in your delete and edit
forms. Why not simply display the text as text then?
Nov 5 '08 #8

P: n/a
In article <1p*******************@reader1.news.saunalahti.fi> , Jukka K. Korpela writes:
>But what's the point of using an input field that cannot be used for input?
It's a method for having information on a page change, possibly as
a result of a calculation. If you create a local application (the
classic example that comes to mind is everybody's favorite, a
mortgage amortization program), you need some way to show the outputs
after the user has provided the inputs.

--
Michael F. Stemper
#include <Standard_Disclaimer>
"Writing about jazz is like dancing about architecture" - Thelonious Monk

Nov 5 '08 #9

P: n/a
Michael Stemper schrieb:
In article <1p*******************@reader1.news.saunalahti.fi> , Jukka K. Korpela writes:
>But what's the point of using an input field that cannot be used for input?

It's a method for having information on a page change, possibly as
a result of a calculation. If you create a local application (the
classic example that comes to mind is everybody's favorite, a
mortgage amortization program), you need some way to show the outputs
after the user has provided the inputs.
Of course, there are other methods of showing data and other content
without using disabled input elements.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Nov 5 '08 #10

P: n/a
Ben C wrote:
On 2008-11-04, shapper <md*****@gmail.comwrote:
>Hello,

I would like to change the look of disabled inputs of type text on my
web site.

Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
... not using an ID or a class ...

There's a :disabled pseudo-selector, but it's CSS 3. You could try and
it see if it works.
How does one declare the version of CSS one is using? I've searched all
over the the answer, and finally gave up.

Catherine
Nov 17 '08 #11

P: n/a
In article <gf**********@news.motzarella.org>,
pecan <pe***@NOSPAMrouxville.infowrote:
How does one declare the version of CSS one is using? I've searched all
over the the answer, and finally gave up.
If you did, it would probably fall on deaf ears.

--
dorayme
Nov 17 '08 #12

P: n/a
On 2008-11-17, pecan <pe***@NOSPAMrouxville.infowrote:
Ben C wrote:
>On 2008-11-04, shapper <md*****@gmail.comwrote:
>>Hello,

I would like to change the look of disabled inputs of type text on my
web site.

Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
... not using an ID or a class ...

There's a :disabled pseudo-selector, but it's CSS 3. You could try and
it see if it works.

How does one declare the version of CSS one is using? I've searched all
over the the answer, and finally gave up.
I don't think you can. You just use what you use and hope the browsers
support it.

These days 2.1 is the one all the browsers are aiming for (not 2,
although if you read the blurbs at the top you would think 2 was meant
to be more pukka). Certain things from CSS 3 (opacity for example) are
also widely supported.
Nov 17 '08 #13

P: n/a

pecan wrote:
>
How does one declare the version of CSS one is using?
For validation purposes, the W3C validator gives you a choice under "more options".

For browsers, you don't. Browsers render per their own capabilities, which you cannot control. If there are conflicting specs between different CSS versions, all you can do is test in the most used browsers, and decide what works best overall.

For example, the width property was required for floats in CSS 2.0, but is optional in 2.1. The only browser I know of that follows 2.0 in this case is Mac IE5, but that's a dead browser so who cares?

--
Berg
Nov 17 '08 #14

P: n/a
pecan wrote:
Ben C wrote:
>On 2008-11-04, shapper <md*****@gmail.comwrote:
>>Hello,

I would like to change the look of disabled inputs of type text on my
web site.

As I said else where in the thread, why would you want to change the
look of disabled input? From a usability standpoint to deviate from what
the user knows and recognizes as a *disabled* control would not be
helpful. Bad idea. Why confuse your users? It is like designer who
insist on using underline instead of bold to emphasize text whn
underlined text is a web convention than means a link!
>>>
Should I add a disabled css class to all these inputs or is it
possible to select them in my CSS Code ...
... not using an ID or a class ...

There's a :disabled pseudo-selector, but it's CSS 3. You could try and
it see if it works.
a 2.1 way is

input[disabled]

*no IE <=6 support.
>
How does one declare the version of CSS one is using? I've searched all
over the the answer, and finally gave up.
Because you cannot. Proper browser behavior is to ignore what it does
not support.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Nov 17 '08 #15

P: n/a
Bergamot wrote:
>
pecan wrote:
>>
How does one declare the version of CSS one is using?

For validation purposes, the W3C validator gives you a choice under
"more options".

For browsers, you don't. Browsers render per their own capabilities,
which you cannot control. If there are conflicting specs between
different CSS versions, all you can do is test in the most used
browsers, and decide what works best overall.

For example, the width property was required for floats in CSS 2.0, but
is optional in 2.1. The only browser I know of that follows 2.0 in this
case is Mac IE5, but that's a dead browser so who cares?
Ahhh... it was when I was validating my css at some stage, that I was
trying to find out how to declare it. Next time I'll look for the "more
options".
Thanks.

C
Nov 17 '08 #16

P: n/a
In article <6o************@mid.individual.net>,
Bergamot <be******@visi.comwrote:
The only browser I know of that follows 2.0 in this case is Mac IE5, but
that's a dead browser so who cares?
Oy!

--
dorayme
Nov 17 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.