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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Valid XHTML inside a textarea

Status
Not open for further replies.

ca8msm

Programmer
May 9, 2002
11,327
GB
What are the best methods for displaying HTML inside a text area, yet still have the page validate to XHTML1.1 strict? For example, say I wanted to do this:
Code:
<textarea>
<html>
...
</textarea>
That wouldn't validate due to the html tag, but I couldn't use the normal method of encoding the html tag to &lt;html&gt; as that will then display like that inside the textarea.

I assume there is a method I can use (xmp, pre?) but I'm just not sure of what would be the recommended method.

Thanks,
Mark


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Basically, what you have there is an overzealous validation system. Stuff inside a textarea should not and would not need to be validated since its not part of the HTML of the page.
But the validator doesn't know that.

I'm not sure there is anything you can do, short of changing the validation service to ignore textarea contents.






----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I suppose there is the option of a custom dtd but that seems like complete overkill to me and I would have thought there would be a simpler solution.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
me said:
I couldn't use the normal method of encoding the html tag to &lt;html&gt; as that will then display like that inside the textarea
I could have sworn that I saw that behaviour before, but revisiting it again it appears that isn't the case and if I encode the values then it is still displayed correctly [ponder]

Oh, well...


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top