9 Replies Latest reply on Nov 20, 2006 5:30 AM by cf_dev2


      Hi i have a cfoutput of some names and check boxes next to them which are grouped. i would like to be able to select all names in one group, with a button, i think i nearly have the code just not quite working, only the first check box in the group is checking.

      can anyone help?
        • 1. Re: Grouping
          cf_dev2 Level 1
          Using CurrentRow to name the checkboxes causes each box to have a different name. Use the value you're grouping by #ShowNames.Team# instead. If "Team" is a string value consider using a numeric value instead. Less potential for javascript problems.
          • 2. Re: Grouping
            C_Macca Level 1
            hi many thanks, not sure how you mean?

            do i have to use current row? or just the query group ?

            • 3. Re: Grouping
              cf_dev2 Level 1
              Use the query group column: #ShowNames.Team# so each group of checkboxes will have the same name.

              One caveat.. the "Team" column looks like a string value. Using free form string values to name form fields can be problematic. Its safer to use a numeric value like (5) instead of a team name like ("San Francisco 49'ers"). If your table has a numeric "TeamID" column then use "TeamID" to name the form fields instead of "Team" name.
              • 4. Re: Grouping
                C_Macca Level 1
                ok i understand now i have done that which works but now on my action page how do i loop through each tick box to input into my database

                i have attached the code i had before which nolonger works
                • 5. Re: Grouping
                  cf_dev2 Level 1
                  I'm not sure I understand the usage of the startRow and dispRows variables on the action page. Are you trying to process all of the fields on your form page or only some of them? Can you briefly describe what your action page should be doing?
                  • 6. Re: Grouping
                    C_Macca Level 1
                    ok all i want to do is set the check box value to '1' if is checked, then input that value into my database where it matches the playerID


                    say i checked 3 boxes next to John, Paul, Jeff

                    i need to then put a value of '1' into my database for each of these names
                    • 7. Re: Grouping
                      cf_dev2 Level 1
                      Ok. Its a bit confusing because the field names in your first example don't all correspond to your action page code. Is form.SMSYes_#currRow# the same as

                      <input type="checkbox" name="myCheckbox_#ShowNames.CurrentRow#" value="checkbox">
                      • 8. Grouping
                        C_Macca Level 1
                        sorry yes it is but i changed it as you told me to

                        <input type="checkbox" name="#ShowNames.Team#" value="checkbox">

                        so i need to now loop through each of these and input them
                        • 9. Grouping
                          cf_dev2 Level 1
                          No. I meant replace the field suffix. So using your original example ..
                          <input type="checkbox" name="myCheckbox _#ShowNames.CurrentRow#" value="checkbox">

                          Instead of CurrentRow, you would use the query group column as the suffix.
                          <input type="checkbox" name="myCheckbox_ #ShowNames.Team#" value="checkbox">

                          But like I said, using a string value like "Team" can be problematic. Its much better to use a number value like "TeamID" if your table has one. Or you could just use a counter like the attached example.