Link to home
Start Free TrialLog in
Avatar of SherryG
SherryG

asked on

Double Quotes problem with Cold Fusion and Text Form Fields

I am storing data in an Access Database.  In some cases the data contains double quotes.  When I use cold fusion to pull the data into a .cfm page the data displays fine.  However, when I pull the same data into a form field (to allow the user to edit it) the form field only displays the data up to the double quotes.

I need  a way for the user to be able to enter and edit data that may contain double quotes.  I know this can be done, but have not been able to figure it out.

Any suggestions?
Avatar of anandkp
anandkp
Flag of India image

User replace function & convert ur double quotes to 2 single quotes & get them displayed properly !

<INPUT TYPE="text" VALUE="<cfoutput>#replace(query.fieldname,'"',"''",'All')#</cfoutput>">

let me know ...

K'Rgds
Anand
Avatar of SherryG
SherryG

ASKER

Am I reading this correctly.

query.fieldname, (single quote)(double quote)(singlequote), (double)(single)(single)(double),'All'

Something does not seem correct.

ASKER CERTIFIED SOLUTION
Avatar of anandkp
anandkp
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SherryG

ASKER

The dreamweaver color coding is not correct.  Almost as if the form field entry is not closed.  But...I tested it and it works.  Thanks for your quick response.
way to go !

cheers
Anand
Just a note - I realize that you marked this as complete - but this will convert all double quotes to 2 single quotes.  This may cause problems for people editing the content.

I think what you really wanted was this :

<input type="text" name="myfieldname" value="#HTMLEditFormat(query.fieldname)#">

Which will preserve the double quotes so the user can edit the text in an input.
Avatar of SherryG

ASKER

Thanks mcichmon that works great!
No problem.

I wasn't trying to steal away points, I just thought you might like this answer instead since you aren't changing the data - just allowing it to display correctly.