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

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

Explorer ,
Jan 24, 2013 Jan 24, 2013

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.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

TOPICS
Advanced techniques

Views

478

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 ,
Jan 24, 2013 Jan 24, 2013

Copy link to clipboard

Copied

LATEST

Why don't you simply post the form?

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