[thelist] singe and double quotes in a text field

Lee Kowalkowski lee.kowalkowski at googlemail.com
Tue Jul 7 10:38:13 CDT 2009


2009/7/7 Daniel Kessler <danielk at umd.edu>:
> I have a text field and I want to allow users to type in information
> that may have both single and double quotes in it.  For example,
>
> <input name="description"  type="text" value="I am the only "Bob" in
> the 'book' if you know what I mean" size="55" maxlength="400" />

You just need to replace your " with &quot;

> How do I go about doing that?  It'll be going into a database and then
> retrieved from there for editing.  I use Cold Fusion as my middle-ware.

You could store them escaped, or escape your double quotes only when
rendering.  I prefer the latter, as it's easier to edit and reuse your
content.

-- 
Lee
www.webdeavour.co.uk



More information about the thelist mailing list