sangeeta bhat
sangeeta bhat

Reputation: 31

How to use the js variable in Cfquery

This is the js Function , I need to use the "DataFileImportID" variable inside the Cfquery.

JS Code

<cfoutput>
    <script language="Javascript" type="text/javascript">
    function Validate(DataFileImportID)
     {
        var DataFileImportID=DataFileImportID;
         alert(DataFileImportID);
        <CFQUERY name="get" DATASOURCE="HeliosMaster">
            select top 1  Description 
            from CDSDB01.dbo.BenchmarkReject  
            WHERE   Filemasterid ='#DataFileImportID#' and Description='Invoice totals do not 
 match loaded charge totals'
        </cfquery>
        alert("tets1");
        alert(get.recordCount);
        return confirm ("test");
     } 
    </script>
</cfoutput>

Coldfusion Code:

<cfif isPower eq 1>
<td align=center>
    <a href="./files/fileBenchmarkApprove.cfm 
      DataFileImportID=#DataFileImportID#&action=A" 
     onclick="Validate(#DataFileImportID#)">
   <img src="/x2intranet/images/approve16x16.jpg" width="16" height="16" 
    alt="Approve" border="0"></a> &nbsp;
</td>
</cfif>

Upvotes: 0

Views: 164

Answers (0)

Related Questions