Checklist Form - Questions Are Color Coded by a Key - Showing Totals

I have a checklist I would like to make digital. The questions are all yes/no and color-coded by a condition level. I am able to color code the questions but my question is, how do I display the total for each condition after or during (running total) the form being answered?
Color-coded conditions:
Green - No problem
Yellow - Cause for concern
Red - serious problem

Red - Does the device turn on? Yes or No radio buttons
Green - Is the device up to date? Yes or No radio buttons

Any suggestions would be appreciated.

Hi Frank. You will need to determine which question is red, green, or yellow. That could be a simple group of arrays like this:

// these are field IDs
$red = array( 1, 6, 4, 14, 25, 21 );
$yellow = array( 2, 3, 5, 9, 10, 12, 23 );
$green = array( 7, 8, 11, 15, 20, 22, 24 );

Then, you will add three new fields in your form, where you will ultimately store the Green, Red, and Yellow score totals.

If you check the box ‘show values’ for the radio button Yes/No choices and give Yes a value of 1 and No a value of 0, you can loop through all the fields in the form with gform_pre_submission filter, color by color, sum up the submitted choices, and then store the totals in the three fields you added to the form.

It’s a little bit of PHP, but it’s not complex. If you have any other questions, please let us know.

Thanks Chris! I’ll give that a try.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.