469,356 Members | 2,055 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Making input read-only

How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?

Thanks - Dave
Jul 20 '05 #1
6 46995
In article <9f**************************@posting.google.com >,
la***********@zipmail.com (D. Alvarado) wrote:
How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?


<input type="text" ... readonly>

Putting the text as normal text inside the document, rather than an
INPUT, would make it more rigid though. Imagine the READONLY attribute
is not supported..

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #2
D. Alvarado wrote:
How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?

Thanks - Dave


<input type="text" value="Not editable" disabled="disabled"/> (XHTML)

OR:

<input type="text" value="Not editable" disabled> (HTML)

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #3
In article <bt**********@reader08.wxs.nl>,
Anne van Kesteren <ma**@annevankesteren.nl> wrote:
How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?

Thanks - Dave


<input type="text" value="Not editable" disabled="disabled"/> (XHTML)

OR:

<input type="text" value="Not editable" disabled> (HTML)


Hmm... was I wrong with my READONLY attribute? Guess it is back to
school for me.

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #4


Kris wrote:
In article <bt**********@reader08.wxs.nl>,
Anne van Kesteren <ma**@annevankesteren.nl> wrote:

How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?

Thanks - Dave


<input type="text" value="Not editable" disabled="disabled"/> (XHTML)

OR:

<input type="text" value="Not editable" disabled> (HTML)

Hmm... was I wrong with my READONLY attribute?


No, if the input is meant to be submitted then readonly is the proper way
<input type="text"
name="inputName"
value="whatever"
readonly>
A disabled control doesn't take part in form submission:
http://www.w3.org/TR/html4/interact/...html#h-17.13.2
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #5
Kris wrote:
Hmm... was I wrong with my READONLY attribute? Guess it is back to
school for me.


I think I'm the one still at school and you're the one with the
experience :-)

<http://www.w3.org/TR/html4/interact/forms.html#adef-readonly>

(this was pointed out by the other comment as well)

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #6
Kris <kr*******@xs4all.netherlands> wrote in message news:<kr*****************************@news1.news.x s4all.nl>...
In article <bt**********@reader08.wxs.nl>,
Anne van Kesteren <ma**@annevankesteren.nl> wrote:
How do I make an input type="text" field read only for pages meant for
display on IE 5+ and Netscape 6+?


<input type="text" value="Not editable" disabled> (HTML)


Hmm... was I wrong with my READONLY attribute? Guess it is back to
school for me.


The specification explains the difference:

http://www.w3.org/TR/html4/interact/...#adef-disabled
http://www.w3.org/TR/html4/interact/...#adef-readonly

The values for 'disabled' controls are not submitted with the form
data set, whereas values for 'readonly' controls are.

--- Safalra (Stephen Morley) ---
http://www.safalra.com/hypertext
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ron | last post: by
6 posts views Thread by Liam Gibbs | last post: by
3 posts views Thread by jb0002 | last post: by
8 posts views Thread by Patrik Malmström | last post: by
10 posts views Thread by Tibby | last post: by
8 posts views Thread by S Shulman | last post: by
48 posts views Thread by Michel Rouzic | last post: by
reply views Thread by Jay | last post: by
4 posts views Thread by Adam Funk | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.