aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Lock Textfields 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 "Lock Textfields" Watch "Lock Textfields" New topic
Author

Lock Textfields

Lauren Pender
Greenhorn

Joined: Jun 15, 2001
Posts: 5
How do you lock a textfield so that javascript can change the value in the textfield, but a user cannot?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Lauren
Set the textfield to readonly
<INPUT TYPE="text" NAME="filedName" value=whatever readonly>
hope that helps
Dave

Dave
Lauren Pender
Greenhorn

Joined: Jun 15, 2001
Posts: 5
Thanks Dave!
xavier romea
Ranch Hand

Joined: Jun 28, 2001
Posts: 37
hi,
The readonly option only works for IE, doesn't it?
I tried on Netscape 4.7 and it doesn't work. I used the onFocus option of the input tag and set: onFocus="this.blur()"
 
jQuery in Action, 2nd edition
 
subject: Lock Textfields