Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default cfif statment logic

    I am having a problem with cfif statment logic.

    If user selects more than 1 checkboxe, my statement doesn't work (nothing is
    displayed on action page). If user selects one checkbox, then statement works
    (correct fields are displayed). I have 19 checkboxes the user could possibly
    select.(i only posted 2 as an example, as nobody was to read through that much
    code).

    I need the appropriate fields to be displayed on the action page, based on the
    checkboxes selected, that's all. How do I deal with represent the results of
    mutiple checkboxes.


    FORM PAGE

    <input type="checkbox" name="INSTREAM_TYPE" value="1">Culvert<br>
    <input type="checkbox" name="INSTREAM_TYPE" value="2">Clear-span bridge<br>


    ACTION PAGE

    <cfif #form.INSTREAM_TYPE# IS 1>
    <table>
    <tr>
    <tr>Culvert<br><input type="Hidden" name="INSTREAM_TYPE" value="1"><br><br>
    Culvert Type:<INPUT NAME="CULVERT_TYPE" Size="20"><br>
    Culvert Material:<INPUT NAME="CULVERT_MATERIAL" Size="20"><br>
    Culvert Length (m):<INPUT NAME="FEATURE_LENGTH" Size="20"><br>
    Impact Length (m): <INPUT NAME="IMPACT_LENGTH" Size="20"><br>
    Impact Description : <INPUT NAME="IMPACT_DESCRIPTION" Size="45"><br>
    Comments:<INPUT NAME="COMMENT" Size="45"></td>
    </tr></table>
    <!--- if clear span bridge is selected--->
    </cfif>

    <cfif #form.INSTREAM_TYPE# IS 2>
    <table><tr>
    <tr>Clear-span bridge<br><input type="Hidden" name="INSTREAM_TYPE"
    value="2"><br><br>
    Length (m):<INPUT NAME="FEATURE_LENGTH" Size="20"><br>
    Impact Length (m): <INPUT NAME="IMPACT_LENGTH" Size="20"><br>
    Impact Description : <INPUT NAME="IMPACT_DESCRIPTION" Size="45"><br>
    Comments:<INPUT NAME="COMMENT" Size="45"></td>
    </tr></table>

    </cfif>

    sviolet Guest

  2. Similar Questions and Discussions

    1. <CFIF> Logic & User Interface
      Hi, Everything works as far as fetching the data... This template accepts FORM field submission and hard coded URL's from a search page, and...
    2. Using an IF statment within an ItemTemplate
      Hello, I have a datagrid listing bill to addresses. One column specifies whether or not the bill to is the primary for the customer. Here's my...
    3. For Statment question
      Ok I've got a For statement that works fine but I need to put a variable in the end_condition for (i=1; i< =_root.totalimages; i++) {...
    4. how to tidy this if statment
      on facie if redcounter = -2 then set the member of sprite(2) to member ("unhO") moodget2 = getat(mood, 5) else if redcounter = -1 then set the...
    5. help with where criteria in sql statment
      hi i have an sql statment that is run in excelwhich works fine but if i want to change the where criteria of the statment i have to go into the...
  3. #2

    Default Re: cfif statment logic

    Because the checkboxes have the same same when a user selects more than one,
    the form value is a list.

    So if the user selects checkboxes "1, 5, 7"

    Then when the form is submitted the variable

    #form.INSTREAM_TYPE# will equal "1,5,7"

    Thus your cfif will fail

    You need to do

    <cfif ListContains(form.INSTREAM_TYPE, 1) Is Not 0>
    blah..............
    <cfelseif ListContains(form.INSTREAM_TYPE, 2) Is Not 0>
    blah....blah...
    </cfif>

    Ken

    The ScareCrow Guest

  4. #3

    Default Re: cfif statment logic

    Thanks very much!
    sviolet 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