• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

greying out of text field

 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using disabled property, replace it with readOnly.

Eric
 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

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

thanks

Anil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic