Forum Moderators: open

Message Too Old, No Replies

Locking Text Areas

         

Programmers

1:03 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



Can you lock text areas like you can in VB, and other non-web-based programming?

I've created forms on my website and have a pre-selected field (based on where they came from), and I don't want the user to edit it. Is there any way I can disable the use of that text area?

adb64

1:39 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



Add the DISABLED attribute to the input or textarea formfields, e.g.:

<INPUT .... DISABLED>
<TEXTAREA .... DISABLED>

(replace .... with all your other formfield attributes)

penders

1:58 pm on Sep 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There is also the READONLY attribute (or readonly="readonly" for xhtml) which is much like the DISABLED attribute, except the text doesn't appear greyed-out and can still be selected, but they still can't change it.

Programmers

11:20 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



READONLY suited my purposes best. DISABLED actually disabled the area completly. Which means it was no good for form submissions.

Thanks everyone. =)