• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

greying out of text field

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic