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

Grouping

New Here ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

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?
TOPICS
Advanced techniques

Views

541

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

correct answers 1 Correct answer

Guide , Nov 20, 2006 Nov 20, 2006
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 att...

Votes

Translate

Translate
Guide ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

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.

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
New Here ,
Nov 19, 2006 Nov 19, 2006

Copy link to clipboard

Copied

hi many thanks, not sure how you mean?

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

thanks

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
Guide ,
Nov 19, 2006 Nov 19, 2006

Copy link to clipboard

Copied

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.

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
New Here ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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

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
Guide ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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?

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
New Here ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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

IE

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

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
Guide ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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">
?

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
New Here ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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

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
Guide ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

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


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