aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes greying out of text field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "greying out of text field" Watch "greying out of text field" New topic
Author

greying out of text field

AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi,

I want to disable a textfield depending on the value from a select menu.

i use javasrcipt (onchange) on the select, and disable the textfield

document.getElementById('repair').disabled=true;
document.getElementById('repair').styleClass='textDisabledClass';

the textfield has a styleId = 'repair' and i am using html:text (part of struts)

The disable works but styleClass does not change in IE. If works well in Mozilla, i can see two different types of textfields depending on the styleClass.


Any suggestions?

thanks

Anil
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
With IE, you can not style a disabled field. You would have to use the readOnly property to do that.

Eric
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi Eric,

How do you use readOnly property to style a disabled field?

I tried using readOnly but it still does not change the styleClass of the textfield.

thanks

Anil
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Instead of using disabled property, replace it with readOnly.

Eric
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi Eric,

I tried it, but still the styleClass does not change. Is it possible to hide the textfield?

thanks

Anil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: greying out of text field