This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Disable Textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disable Textfield" Watch "Disable Textfield" New topic
Author

Disable Textfield

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 815
Hi,
Does anyone know how to disable a text field in a form? ReadOnly seems to only apply to IE as does Disable when I've tried them. I thought DISABLE also worked in NS but when tried it didn't. I've included a in-line style sheet in the text field along with the size, name, and onclick method. I was wondering if order mattered much in NS? I normally would look at my notes but I'm away right now. Any help would be appreciated.
Rob
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
try
<input onfocus="this.blur()" onchange="this.value=''
note: some thricks with copy/paste could still put value into element, this is why you need onchange.
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 815
Thanks for the reply. I'll take it from that, that there is no property that applies to NS that accomplishes this. I was hoping not to have to resort to this round about approach but I guess I'll have to. Thanks again for your reply.
Rob
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Disable Textfield
 
Similar Threads
JtextField addKeyListener
Disabling html:text in Struts dynamically
Retrieving LONGVARCAR data type from SQL Server
Readable Text Field
Using ItemListener on a JMenu