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

JavaScript to Cold Fusion query

Guest
Apr 10, 2007 Apr 10, 2007

Copy link to clipboard

Copied

I have two pages and I'm trying to extract the URL value and drop it in the SQL. I HAVE TO use the Javascript to pass the variable.
TOPICS
Advanced techniques

Views

341

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 ,
Apr 10, 2007 Apr 10, 2007

Copy link to clipboard

Copied

Why do you have to use javascript? Anything you are likely to want from the url is probably available in the cgi scope somewhere.

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
Advocate ,
Apr 10, 2007 Apr 10, 2007

Copy link to clipboard

Copied

What URL value are you trying to extract? It seems as if you are passing the value of a form field to a popup window via URL variables. Is that right, or did I miss something? What happens when you alert() the value of your lname form field before you send the data? Are you addressing the form field correctly? What about when you perform a <cfdump> of the URL variables on your page2.cfm? Is your "URL.lname" variable passing correctly?

Also, once you figure out how to pass your variable, I would recommend using <cfqueryparam> with your EmployeeDirectory query. It might speed things up a little and help protect you against XSS and SQL injection.

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
Enthusiast ,
Apr 10, 2007 Apr 10, 2007

Copy link to clipboard

Copied

LATEST
The following is incorrect
if (document.forms['lname'] != null)
You don't have a form named 'lname' thus the if will always fail.
Should be
if(document.forms[0].elements['lname'].value != '')

Also your using the Like evaluation in the sql query, but it will only ever match an equals.

Ken

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