• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Searching for a URL in a form field!

Guest
Mar 16, 2013 Mar 16, 2013

Copy link to clipboard

Copied

I need help searching one of my form fields for any URL’s that are being passed to my list.

In the form field I am receiving content that looks like the following:

nhiccdppqfstupxo, <a href="http://.com/">abc</a>, abc, abc, http://.com/ abc, abc bz.

I need to use a RE function to check the form field for “http” and if it’s there abort the script so that it doesn’t send out to my list.

The problem I am having is that when I use CF functions I receive an error because of the quotes that are in the form field. 

Anyone have any ideas as to how I can test for URL’s in a form field?

Thanks for any help that you can offer!

  CTownNick

TOPICS
Advanced techniques

Views

534

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2013 Mar 16, 2013

Copy link to clipboard

Copied

What function is giving you the error?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 16, 2013 Mar 16, 2013

Copy link to clipboard

Copied

Dan I was using REfind but I got the answer in another post that I posted.

What I had to do was sent up a field and load the form field into it, like the following...

<cfset stringToSearch = '#form.xxx#'>

 

<p>

<cfset foundit = '#FindNoCase("http",stringToSearch)#'>

<cfif foundit gt 0>

        <cflocation url="http://www.somewhere.com">

        <cfabort>

</cfif>

If there is no URL in the form field the rest of the script runs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2013 Mar 17, 2013

Copy link to clipboard

Copied

LATEST

Dan,

This is how I set the code up:

What I had to do was set up a field and load the form field into it, like the following...

<cfset stringToSearch = '#form.xxx#'>

(notice the single quotes, the code would not work if I used double quotes because there are double quotes in the URL that they entered, that was what was killing me in the first place using Refind!)

<p>

<cfset foundit = '#FindNoCase("http",stringToSearch)#'>

<cfif foundit gt 0>

        <cflocation url="http://www.somewhere.com">

        <cfabort>

</cfif>

If there is no URL in the form field the rest of the script runs.

Again thanks for taking the time to help me, I appreciated it very much!

Nick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation