Copy link to clipboard
Copied
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.DiagnosisIDFROM 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
Copy link to clipboard
Copied
Why don't you simply post the form?