Click here to get back home

how to display whatever the user types in a textarea

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
how to display whatever the user types in a textarea s.chelliah 11-17-2005
Get Chitika Premium
Posted by s.chelliah on November 17, 2005, 1:24 pm
Please log in for more thread options


We have an input field which allows the user to enter a string of (up
to 62) ASCII printable characters. We have a need to allow the user to
be able to specify any sequence of characters he/she desires.

However, we have a problem when we attempt to display this same string
of characters. If the input sequence of characters contains HTML
interpretable strings of characters, the user's sequence of characters
is not properly displayed. (We are using <td>string</td> to display the
string.)

For example:
If the user enters "ID-12<DALLAS>\STV"
the string is displayed as "ID-12\STV"

The problem is that the text "<DALLAS>" is being interpreted as an HTML
tag. We can circumvent this problem by pre-parsing the display string
and replacing the "<" with "&lt;", resulting in the proper display of
the string.

However, there is a very long list of standard HTML characters whose
mnemonic and/or numeric representations are translated by HTML for
display purposes.

For example:
If the user enters "ID-12&iexcl;" or "ID-12&#161;"
the user expects the string to be displayed as "ID-12&iexcl;" or
"ID-12&#161;", not "ID-12!" (where the "!" actually represents an
inverted exclamation point).

We have tried to display the user's string with <PRE>string</PRE>,
<CODE>string</CODE>, <BLOCKQUOTE>string</BLOCKQUOTE> and even the
deprecated <LISTING>string</LISTING> to no avail. Even though our
reference text implies that the sequence of characters between <PRE>
and </PRE> will not be interpreted by HTML, both of our browsers (MS
and Netscape) do interpret the characters.

Is there any way to display a sequence of characters without the
browser interpreting the sequence of characters?
Thanks,
Siva


Posted by Darin McGrew on November 17, 2005, 9:39 pm
Please log in for more thread options


> Is there any way to display a sequence of characters without the
> browser interpreting the sequence of characters?

See http://www.htmlhelp.com/faq/html/basics.html#show-html

Darin McGrew, mcgrew@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, darin@htmlhelp.com, http://www.HTMLHelp.com/

"The early bird gets the worm, but the second mouse gets the cheese."
--
Darin McGrew, mcgrew@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, darin@htmlhelp.com, http://www.HTMLHelp.com/

"The early bird gets the worm, but the second mouse gets the cheese."

Posted by Benjamin Niemann on November 17, 2005, 10:43 pm
Please log in for more thread options


s.chelliah@gmail.com wrote:

> The problem is that the text "<DALLAS>" is being interpreted as an HTML
> tag. We can circumvent this problem by pre-parsing the display string
> and replacing the "<" with "&lt;", resulting in the proper display of
> the string.
>
> However, there is a very long list of standard HTML characters whose
> mnemonic and/or numeric representations are translated by HTML for
> display purposes.

one, two, many ;)
There are in fact only three characters that must be encoded: '<', '>' and
'&'. A pretty long list, I must admit...

> For example:
> If the user enters "ID-12&iexcl;" or "ID-12&#161;"
> the user expects the string to be displayed as "ID-12&iexcl;" or
> "ID-12&#161;", not "ID-12!" (where the "!" actually represents an
> inverted exclamation point).

It is sufficient to quote the '&' here:

User enters: "ID-12&iexcl;"
Inserted into HTML: "ID-12&amp;iexcl;"
Displayed: "ID-12&iexcl;"

> We have tried to display the user's string with <PRE>string</PRE>,
> <CODE>string</CODE>, <BLOCKQUOTE>string</BLOCKQUOTE> and even the
> deprecated <LISTING>string</LISTING> to no avail. Even though our
> reference text

Time to look for a correct reference text.

> implies that the sequence of characters between <PRE>
> and </PRE> will not be interpreted by HTML, both of our browsers (MS
> and Netscape) do interpret the characters.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/

Similar ThreadsPosted
IE TextArea Display Bug January 12, 2005, 10:16 am
types of audio files for web page April 28, 2005, 4:59 pm
W3C discussion of link types and language February 24, 2006, 11:26 am
mime types in Apache and the validator June 6, 2008, 7:58 am
xhtml, custom dtds, and MIME types January 27, 2006, 2:34 pm
User editing September 22, 2006, 11:16 am
get user color schemes September 4, 2004, 5:02 am
User Scalable Text Using CSS? March 25, 2006, 10:03 am
Allow the user to increase font size December 2, 2005, 6:43 pm
User stylesheets for specific sites December 21, 2005, 8:33 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap