Highlighted

Escape character

New Here ,
Sep 28, 2006

Copy link to clipboard

Copied

Hi,

Does anybody know if coldfusion contains an escape character for double quote (") characters? (it's got to)

I've got a web page with a form with a text box and I'm trying to pre-load it with a value. I'm able to do this fine using the value attribute of the input tag, but whenever the data I attempt to load contains a double quote, the data is not rendered correctly in my HTML. This is because the input tag's value attribute interprets the first double quote it encounters in the data to be the end of the text it needs to include in the attribute.

So I thought I would try to replace all the double quotes in my data with the appropriate HTML double quote escape character (") and then pass the corrected string into the value attribute.

So far that code looks like this:

Replace(my_string,"need help here",""")

But of course now I need to determine the CFML escape character so I can plug it in for "need help here" above.

Anybody know?

Thanks!

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Escape character

New Here ,
Sep 28, 2006

Copy link to clipboard

Copied

Hi,

Does anybody know if coldfusion contains an escape character for double quote (") characters? (it's got to)

I've got a web page with a form with a text box and I'm trying to pre-load it with a value. I'm able to do this fine using the value attribute of the input tag, but whenever the data I attempt to load contains a double quote, the data is not rendered correctly in my HTML. This is because the input tag's value attribute interprets the first double quote it encounters in the data to be the end of the text it needs to include in the attribute.

So I thought I would try to replace all the double quotes in my data with the appropriate HTML double quote escape character (") and then pass the corrected string into the value attribute.

So far that code looks like this:

Replace(my_string,"need help here",""")

But of course now I need to determine the CFML escape character so I can plug it in for "need help here" above.

Anybody know?

Thanks!

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Sep 28, 2006

Copy link to clipboard

Copied

Nevermind!

No sooner do I post a question, than I try a new search and find my answer. Hope I didn't waste anyone's time with this.

The function HTMLEditFormat(stringToFormat) takes care of making your string HTML friendly.

Thanks!





Just like washing your car

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Sep 28, 2006

Copy link to clipboard

Copied

Three characters you usually want to escape are single quotes, double quotes, and octothorps. Simply use two of them instead of 1.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Sep 28, 2006

Copy link to clipboard

Copied

Does anybody know if coldfusion contains an escape character for
double quote (") characters? (it's got to)

Yup, its the double quote character. In cf to escape cf control
characters you double them. I.E. "" to escape the double quote, '' to
escape the single quote and ## to escape the pound|hash sign.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
ColdFusion User Guide
CFML Reference Guide
Develop CFML Applications
Add a group