Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Override the gray text generated from disabled="true"

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI!
I've search high and low for a solution for this...so any ideas would be great!!
I need to display webpages in 'read' mode with all text fields disabled. To obtain the same look as 'edit' mode, I am using a .css to set a background color of light blue. Unfortunately, when I add disabled="true", the text becomes light gray and is barely visable (Acutally, it's barely visable when the background color is white!". I would like to overrid the light gray color and change it to black.
<input type="text" class="pagecontentreadonly" readonly="true" disabled="true" name="text" maxlength="8" size="8" value="" id="text">
 
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of disabled try with readonly attribute
 
Tricia Schenk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That does work in some instances...but I am using STRUTS for some controls on the page and STRUTS will not accept readonly="true"...it's not defined in the tag library.
<html:select disabled="true" styleClass="pagecontentreadonly" name="ideaForm" property="initiativeList" multiple="true" size="5">
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing you can do unless you use javascript to recreate the effect of disabled, but it is a lot more work then that little tag.
 
Tricia Schenk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip...I will stop trying to make it work and try to change the background color so the light gray is more readable!
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to apply CSS styling to the field?
Does the Struts tag allow you to at least specify an id (or generate one from the name attribute)?
bear
(biting his tongue regarding frameworks that hobble you)
 
Tricia Schenk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes...tried that too
I'm using styleClass="pagecontentreadonly" ...
<html:select disabled="true" styleClass="pagecontentreadonly" name="ideaForm" property="initiativeList" multiple="true" size="5">
...defined on my .css as -->
.pagecontentreadonly { background: #EFEFF1; color: black; font-family: verdana, helvetica, arial, sans-serif; font-size: x-small; font-weight: normal; font-style: normal; text-decoration: none; }
and it still overrides the text of color:black!
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ick, ugh, the other tactic I can think of would be, since Struts won't let you specify readonly on the tag, is to sledge-hammer this setting in the onload() handler. Something like:

bear
(still biting tongue regarding frameworks that create more work than they save)
[ August 28, 2003: Message edited by: Bear Bibeault ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tricia!

Just wanted to know whether you were able to solve the problem because i and a friend of mine also are looking for a solution on how to override the gray text generated from disabled="true". Like you, we already tried the css. All font properties can be edited but not its color. Pls. reply.
Thanks.

Cindy
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only thing you can do is set the field to readOnly and change the properties of it that way.

Eric
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this field is read only, why dont you just use a span with nice formating to replicate input look and feel? This way you able to change anything, and user can't use scriplets to enable a field.
If you expect this value to be submitted, put an <input type=hidden>
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
disabled fields usually do not get submitted....That is what I am thinking off the top of my head, or I could be still asleep!
 
Something about .... going for a swim. With this tiny ad ...
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic