Click to See Complete Forum and Search --> : How do you make a text field uneditable
zonome
05-09-2003, 06:07 AM
Hi,
I have a text field on my web page that would like to make uneditable so that the users can not change its contents.
Does anyone know on how to do this?
SniperX
05-09-2003, 06:16 AM
You have to lock the text field,
cant remember how
Charles
05-09-2003, 06:19 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<form action="">
<div>
<input type="text" value="3.14159265358979" readonly>
</div>
</form>
zonome
05-09-2003, 06:22 AM
Does this work with HTML 4 only?
Charles
05-09-2003, 06:26 AM
Originally posted by SniperX
You have to lock the text field,
cant remember how Bookmark this URL - http://www.w3.org/TR/html4/. You will find answers to all of your HTML questions there. And it is not possible for anything at that address to be incorrect. You might even want to keep a local copy of the files as I do. I didn't remember that either, but a quick check of the spec and I found the answer in less than a minute.
Charles
05-09-2003, 06:28 AM
Originally posted by zonome
Does this work with HTML 4 only? I don't know about HTML 4 - that went out the window back in 1999 - but it does work in HTML 4.01. What version of HTML do you want to know about?
zonome
05-09-2003, 06:29 AM
Well...I just tried it and it did not work! the text is still editable
Charles
05-09-2003, 06:39 AM
I just rechecked it in two different browsers and it works for me. Have you done something wrong? Are you using some kind of inferior browser?
zonome
05-09-2003, 06:42 AM
I am using IE5...do I need to include all the below in my HTML?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
Charles
05-09-2003, 06:48 AM
Those are required for any valid HTML document, so yes include them. You might need to update to a better browser. Try Opera, or Mozilla of Explorer 6.
zonome
05-09-2003, 06:58 AM
I can not upgrade.
This is the company standard browser that I and all the users of my application will use. If it does not work with this browser then I have to look at an alternative solution.
Charles
05-09-2003, 07:02 AM
Then give this a try. There's also a JavaScript method that wont allways work but if you combine the two you just might get the coverage that you need. (You will need to keep the non-JavaScript method there to avoid lawsuits under Title I of the ADA).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<form action="">
<div>
<input type="text" value="3.14159265358979" onfocus="this.blur()" readonly>
</div>
</form>
farrelldoc
05-26-2008, 07:53 AM
I am using IE5...do I need to include all the below in my HTML?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
The following also works for me, which might be a little less restrictive, I don't know. I'm no expert. Dreamweaver puts it in for me. I tested in IE7 and FF (whatever the latest is on 5/26/08--I already closed it).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">