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

Quotes in preview page not processing 2

Status
Not open for further replies.

toyt78

Technical User
Apr 5, 2005
125
0
0
US
I have a update preview page (working with Access 2000 database) that works but the only problem is if the text input has quotes in it the information is cut off where the quotes start:

Data entered in fieldOne: here is "word"
would be entered in database as: here is

Code:
The update page:
<cfquery datasource="dsname" name="q1">
select * 
from tableOne
where fieldID = #URL.fieldID#
</cfquery>
<cfoutput query="q1">
<form action="Preview.cfm" method="post">
<input type="hidden" name="fieldID" value="#fieldID#">
<input type="text" name="fieldOne" value="fieldOne">
<input type="submit" name="Preview" value="Preview">
</form>

Preview.cfm page:
<cfparam name="form.fieldOne" default="">
Show Preview info:<br>
#FORM.fieldOne#<br>
<form action="actionPage.cfm" method="post">

<input type="hidden" name="fieldID" value="FORM.fieldID#">
<input type="hidden" name="fieldOne" value="FORM.fieldone#">

<input type="submit" value="Submit">
</form>
</cfoutput>

Please advise how I can get this to work. I would like to keep using the "hidden" fields in the preview page so that is why I am not using cfinput.
 
You'll have to escape the double quotes or replace them with single quotes for the data to show. As is, you're truncating the value of the hidden field:

...value="here is "word" something"> so the double quote prematurely ends the value attribute.

Try replacing the quote by escaping it (two in a row) or using a single quote. You'll have to deal with it on the insert/update page, but it's the only way to handle displaying quote marks.

Show Preview info:<br>
#REPLACE(FORM.fieldOne,"""","""""","ALL")#<br>

(Notice it has to be escaped in the function, also.)

HTH,


Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
try in the input value="#htmleditformat(FORM.fieldOne)#"

so you don't have to worry about single quoutes, or < & >

 
thanks to both of you.

I never heard of htmleditformat(FORM.fieldOne)

It seems to work best when I put it in my Update AND Preview page for fieldOne

Is it okay to put a trim in front of it on my Update page:
#trim(htmleditformat(FORM.fieldOne))#

and what are some of the precautions I should know about when using the htmleditformat function??
 
Also which one is the best or most efficient to use??

The #REPLACE(FORM.fieldOne,"""","""""","ALL")#
or the htmleditformat??


 
HTMLEditFormat takes care of all of the characters that would cause problems for you.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
Thanks, so I will use the htmleditformat on all my fields and probably should always use that function??
 
trim is totaly fine. I find it annoying when a user hits spaces after their name or something.

 
TRIM doesn't handle the special characters that cause problems in toyt78's situation, although it is a good general rule to use it with text fields.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top