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

displaying quotes in input boxes 1

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
I have an input box that allows the user to enter some company information. It is a free form text entry and I have come across a problem. If the user enters a quote in the box and then come back to edit the information he loses everything after the quote.

This is too obvious a problem for there not to be a fix, but I can't figure it out for the life of me.
[tt]
<input type='text' name='compname' value='Bob's Services'>
<input type='text' name='compnote' value="Bob is "helpful"">
[/tt]
See the problem?
 
How are you printing those lines of HTML to the screen? What scripting language?

*cLFlaVA
----------------------------
"Holy crip he's a crapple!
 
ASP, but its an HTML problem that I am going to be having in Perl, PHP, MAS90, and one C app (I imagine).
 
It's a langauge dependant thing...
PHP has "strip slashes" and "add slashes" to protect against these things.
I assume ASP and perl do to.
C++ you'll have to parse yourself....

Also, watch out for the lessthan and greater thans... so that HTML/PHP inserts can't happen.
 
So what is the end HTML result that I have to add to the value to get the quotes displaying?
 
A single quote (apostrophe) should be: &#39;
Double quote should be: &#34;

Even better, proper curly quotes could be: &rsquo; and &lsquo; (right single quote and left single quote) or &rdquo and &ldquo; (right double quote and left double quote)
 
Oops... That was the first thing I tried... except I put &39; not &#39;

I don't know whether curly quotes will be an issue. The only reason the single quotes were an issue was because I use them as my html string identifiers. It was ending my attribute value early. Curly quotes shouldn't do that.

Much thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top