Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabled textarea 2

Status
Not open for further replies.

ma77c

Programmer
Jan 27, 2006
28
CA
I have a multi-line textbox which I have disabled so users can only view the text, not edit (pretty basic). My problem is, I would like to still have the scrollbar enabled, in case there is more text than what fits in the area. Is there a way to achieve this? Thanks.
 
Make it readonly. And if eventually you do not want to submit it, turn it to disabled at submit time.
 
A note on readOnly. If you set readOnly within the HTML of the textarea then case is not important but if you try to toggle the readOnly property from javascript then it must be readOnly with the capital O. You could spend a lot of time trying to figure out why it is not working otherwise. :)



Stamp out, eliminate and abolish redundancy!
 
Thanks for the tips guys. I was unaware of this property.

Stars all around!
 
You are welcome and thanks for the star.

One more thing to remember when using the disabled property, any input fields with disabled set will NOT submit their values when the form submits so you would not be able to read those values in on the next page.

In some cases that would not matter to you since if the field was disabled so they could not change the option then the value may not be needed but if for instance you read the form values in on an ASP page you would have to test if the value came in NULL so your script does not hang up further down the line.


Stamp out, eliminate and abolish redundancy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top