Search code examples
formscoldfusioncoldfusion-2016

ColdFusion HTML Form breaking on quotes


Oddly I have a form that will not pass a double quote?

For Example:

10 and single ' this" And " Another

In the Input form stops at: 10 and single ' this

Why is it not preserving the double quote? "

I do have the form type as: enctype="application/x-www-form-urlencoded"

I have other forms that are just fine with quotes.


Solution

  • What happens here is that the double quote mark in the text 10 and single ' this" And " Another is breaking the input element.

    The text with " will prematurely end the value attribute.

    eg <input value="10 and single ' this" And " Another">

    To get over this, you'll need to user

    <input value="#encodeForHTMLAttribute(formValue)#">