1 Reply Latest reply on Jan 24, 2013 3:18 PM by Dan Bracuk

    I want to use the user's input to parameterize a query in the same cfm file

    NatheManning Level 1

      Is there any way to use the a cfinput value entered at the top of a form in a cfquery as a where clause value?  I am trying to create a dynamically generated table of checkboxes based on what is returned for a single SSN from the database.

       

      My query so far is:

       

       

      <cfquery name="PatientDiagnoses" datasource="ccta">
            SELECT Diagnoses.DiagnosisID, 
                          Diagnoses.Diagnosis, 
                          "Selected" = CASE WHEN Diagnoses.DiagnosisID IN
                                     (SELECT ReferringDiagnosis.DiagnosisID
                      FROM ReferringDiagnosis 
                           WHERE SSN = '#FORM.SSN#')
            FROM Diagnoses
            ORDER BY Diagnosis
       </cfquery>
      
      
      
      

       

      But of course FORM.SSN which is the cfinput field I want to use is doesn't exist, because the form hasn't posted yet.

       

      Is there away to use ColdFusion.GetElementValue() and put the results in a CF variable I can use in this query?

       

      Nathan Manning