Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

CF Pound sign

Good morning,
  I have a user input field in a form where the folks submit IT Department Job requests.

Working fine except when they use the # sign in their data input.  CF will input the data, but on my "view" form returns no values when that field is selected.

Is there a way for Coldfusion to treat the # sign in text field data as regular text instead of a partial CF Tag?

Thanks,
L
Avatar of margant
margant

I think you need to try ##
Best of luck,
AM
Before you submit the text to your database you could replace "#" with the HTML equivalent "&pound".
wait, that'll insert a british pound sign.  Nevermind.
Avatar of Larry Brister

ASKER

to all....

I'm not inputting data.  An end user is.  I wnat to be able to strip it out or replace it when they submit their data.

lr
Try adding this on your submit page:

<cfset fieldname= REReplaceNoCase(fieldname, '#','##','ALL')>

Where fieldname is replace with the name of the field the user is entering in the # signs.
Now that i think about it that might give you an error, try this

<cfset form.fieldname= replace(form.fieldname,"##","####","all")>
use a javascript to validate the input

Following the path of saramsureshbabu i have to say that Coldfusion has some build in validation inside its form field objects, that automatically render to javascript.

-AM
ok folks...

Here's what I get...

A user input's data like this in an input field.    "Please fix the Access Database.  Call me at #(Phone number)."  Let's say the input field is dbo.col.getans

I have another form where I have a link on the field to bring up and modify...

<cfoutput><a href="index.cfm?getans=#getans#">#getans#</a></cfoutput>

Next page has

SELECT * from table where getans='#getans#'

When I try and output the data...I get a blank page.

I suspect that the output is reading the extra # sign and waiting for another.  That's why I want to strip it off on the user input end.

inside string use ## instead of #
<cfoutput><a href="index.cfm?getans=##getans##">#getans#</a></cfoutput>
ASKER CERTIFIED SOLUTION
Avatar of thecode101
thecode101

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
margant......thanks...points being awarded now.
L
To fit it to your data
<cfset form.dbo.col.getans= replace(form.dbo.col.getans,"##","","all")>