Multiple criteria from FORM field in a quiry

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Multiple criteria from FORM field in a quiry

    I've got an input form where i'm trying to sort dates in an output quiry.
    The date out put should either list open, or closed, or all issue from the
    database.
    Here is the code from the input form. (dataSelection)
    ===========================
    <form name="form1" method="post" action="output.cfm">
    <p>&nbsp; </p>
    <p> Select Region
    <input type="radio" name="region" value="EMEA">
    EMEA
    <input type="radio" name="region" value="US">
    US</p>
    <p>Issue status
    <input type="radio" name="date_closed" value="NULL">
    Closed
    <input type="radio" name="date_closed" value="NULL">
    Open
    <input type="radio" name="date_closed" value="">
    ALL </p>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </p>

    And here is the code of the quiry i'm having sofar. (output)
    ========================================
    <cfparam name="FORM.region" default="1">
    <cfparam name="FORM.date_closed" default="1">
    <cfparam name="PageNum_laden" default="1">
    <cfquery name="laden" datasource="issue">
    SELECT * FROM tbl_issue WHERE region IS '#FORM.region#'
    AND date_closed >...............< here i'm lost..
    </cfquery>

    fluiter Guest

  2. Similar Questions and Discussions

    1. Multiple search criteria with empty field option
      Hi guys! I know I am being dumb here but running out of ideas. I am a newbie to php and mysql and progressing quite well. However, I am currently...
    2. Remove form field duplicated across multiple pages
      Can a (text) form field duplicated across multiple pages in Acrobat 6.0.1 be removed in a simple operation, or must the field be removed from each...
    3. form: single line -- multiple text boxes -- one typing field - how?
      please excuse my ignorance. am a newbie. I saw a fillable form, that shows:- a single line with multiple text boxes for entering each letter of a...
    4. #25421 [Bgs->Opn]: $_POST doesn't show the value of select form field when multiple=true
      ID: 25421 User updated by: khalid_kary at hotmail dot com Reported By: khalid_kary at hotmail dot com -Status: Bogus...
    5. Criteria/Field Problem
      Hello, I've done all the complicated stuff just fine, and now I have one simple task left. Of course it's the "simple" thing that has me stopped in...
  3. #2

    Default Re: Multiple criteria from FORM field in a quiry

    I'm guessing

    A) if an issue is "Closed" the date column value will not be NULL
    B) if an issue is "Open" the date column value will be NULL
    C) if the selected issue type is "ALL" then you want to ignore the date column?

    If this is what you want, try setting the value of the radio button to
    "closed", "open" and "all". Then on your action page:

    <!--- not tested --->
    <cfparam name="FORM.date_closed" default="all">
    <cfquery name="laden" datasource="issue">
    SELECT * FROM tbl_issue
    WHERE region IS '#FORM.region#'
    <cfif trim(form.date_closed) eq "closed">
    AND date_closed IS NOT NULL
    <cfelseif trim(form.date_closed) eq "open">
    AND date_closed IS NULL
    </cfif>
    </cfquery>

    mxstu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139