3 Replies Latest reply on Apr 10, 2007 4:32 PM by The ScareCrow

    JavaScript to Cold Fusion query

      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.
        • 1. Re: JavaScript to Cold Fusion query
          Dan Bracuk Level 5
          Why do you have to use javascript? Anything you are likely to want from the url is probably available in the cgi scope somewhere.
          • 2. JavaScript to Cold Fusion query
            insuractive Level 3
            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.
            • 3. Re: JavaScript to Cold Fusion query
              The ScareCrow Level 1
              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.