Copy link to clipboard
Copied
My user entered street names with double quotes and crashed my app.:
"32 street" instead of just 32 street.
I did not think of checking for double quotes at the time and I need to modify my codes now.
I need to find how many address entry has double quotes then produce a report so users can fix their feed.
I think my syntax below i wrong that's why I got error mesage from CF. Can anyone help with the right syntax on how to search a double quores in a string?
<CFIF ListFindNoCase(StreetName, " " ") NEQ 0>
create report
</CFIF>
Copy link to clipboard
Copied
First, you want to use contains, not ListFindNoCase.
Next, if the string you seek contains double quotes, use single quotes to quote the string, and vice versa.
Or, you can look for chr(34).
Copy link to clipboard
Copied
GKiew wrote:
<CFIF ListFindNoCase(StreetName, " " ") NEQ 0>
create report
</CFIF>
Almost.
<cfif findNoCase('"', streetname) NEQ 0> <!--- single quote, double quote, single quote, in that order, without spaces in between --->
Copy link to clipboard
Copied
My user entered street names with double quotes and crashed my app.:
"32 street" instead of just 32 street.
I did not think of checking for double quotes at the time and I need to modify my codes now.
I need to find how many address entry has double quotes then produce a report so users can fix their feed.
Instead of "fixing" the data, why don't you fix your app so that the double quotes aren't a problem? Don't treat the symptom: treat the problem.
--
Adam
Copy link to clipboard
Copied
Adam Cameron. wrote:
My user entered street names with double quotes and crashed my app.:
"32 street" instead of just 32 street.
I did not think of checking for double quotes at the time and I need to modify my codes now.
I need to find how many address entry has double quotes then produce a report so users can fix their feed.
Instead of "fixing" the data, why don't you fix your app so that the double quotes aren't a problem? Don't treat the symptom: treat the problem.
--
Adam
I agree. Granted, it is often difficult, even impossible, to fix your application such that users will enter the kind of data you want. However, your application shouldn't crash because of bad user input. This suggests you should validate the form variables.