8 Replies Latest reply on Aug 24, 2007 1:27 PM by AJ803

    CFIF selecting only last entry

      I'm selecting all entries that meet the criteria of #ccdirect# = #cklstdirflg# and the radio button For N/A is selected; however, it always selects just the last entry that fits the criteria. Does anyone have a clue what I'm missing?
        • 1. Re: CFIF selecting only last entry
          cf_dev2 Level 1
          If you give a set of radio buttons the same name ("cclselect") then only 1 of those radio buttons can be checked at one time.

          If you want each set of YES - NO - N/A buttons to behave as a separate group, I think you'll have to name them dynamically.

          • 2. Re: CFIF selecting only last entry
            AJ803 Level 1
            I renamed all the cclselect and only the last entry is still being marked. Any other ideas?

            <cfif #ccdirect# is #cklstdirflg#>

            <td><input type="radio" name="filteryes" value="Yes"></td>
            <td><input type="radio" name="filterno" value="No"></td>
            <td><input type="radio" name="filterna" value="N/A" checked></td>
            <td><input type="radio" name="yes" value="Yes"></td>
            <td><input type="radio" name="no" value="No"></td>
            <td><input type="radio" name="na" value="N/A"></td>
            • 3. Re: CFIF selecting only last entry
              Dan Bracuk Level 5
              My idea is for you to read cf_dev2's answer again.
              • 4. Re: CFIF selecting only last entry
                AJ803 Level 1
                You're right, I didn't read icf_dev2's answer correctly. So I rewrote the code so each set had an individual name set, but it's still not working:

                <td><input type="radio" name="cclselectfilter" value="Yes"></td>
                <td><input type="radio" name="cclselectfilter" value="No"></td>
                <td><input type="radio" name="cclselectfilter" value="N/A" checked></td>
                <td><input type="radio" name="cclselect" value="Yes"></td>
                <td><input type="radio" name="cclselect" value="No"></td>
                <td><input type="radio" name="cclselect" value="N/A"></td>
                • 5. Re: CFIF selecting only last entry
                  cf_dev2 Level 1
                  I think you misunderstood.

                  Each set of 3 buttons must have a different name

                  <input type="radio" name="cclselect1" value="Yes">
                  <input type="radio" name="cclselect1" value="No">
                  <input type="radio" name="cclselect1" value="N/A" checked>

                  <input type="radio" name="cclselect2" value="Yes">
                  <input type="radio" name="cclselect2" value="No">
                  <input type="radio" name="cclselect2" value="N/A" checked>

                  <input type="radio" name="cclselect3" value="Yes">
                  <input type="radio" name="cclselect3" value="No">
                  <input type="radio" name="cclselect3" value="N/A" checked>
                  • 6. Re: CFIF selecting only last entry
                    AJ803 Level 1
                    Yes, I did misunderstand. I can't get my brain wrapped around why three sets when I only have two different criteria; however, it does work and I need to figure out the format. Thanks!
                    • 7. Re: CFIF selecting only last entry
                      cf_dev2 Level 1
                      You don't need 3 sets specifically. That was an example of dynamically named sets of radio buttons.

                      Simply use a counter to dynamically name each set of radio buttons inside your output loop. You can use the "CurrentRow" variable.

                      <cfloop query="..." >

                      <td><input type="radio" name="cclselect#CurrentRow#" value="Yes"></td>
                      <td><input type="radio" name="cclselect#CurrentRow#" value="No"></td>
                      <td><input type="radio" name="cclselect#CurrentRow#" value="N/A"
                      <cfif ccdirect is cklstdirflg>checked></cfif>>
                      • 8. Re: CFIF selecting only last entry
                        AJ803 Level 1
                        Thanks so much for your patience cf_dev2. It works great; I really appreciate your help!