Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Need help counting responses from multiple drop down list boxes

Avatar

Former Community Member

Hi everyone,

I'm a newbie and need help.

My form is an "evaluation form" where the user selects repsonses from drop down list boxes for 12 different categories.  The choices are:

Exceeds expectations

Meets expections

Needs inprovement

Failed to meet expections

Each response has a value:  4 down to 1

I need to create a summary of how many rating were 4, how many were 3, etc.

I can count the frist category with an "if " statement but I can not count any of the remaining 11 categories.

How should I do this?

Thanks!

Candace

1 Reply

Avatar

Level 2

You will need to set up hidden fields to old the values.

If you have a submit/save button place the script behind the click event of that button.

If you want to calculate as the user selects from the drop down then put the script on the calculate event of the hidden field.

The script is long winded and someone with a bit more javascript expertiese may be able to provide a simplier version.

var total1 = 0;

var total2 = 0;

var total3 = 0;

var total4 = 0;

if (dropdown1.rawValue == "1")

     {

          total1 = total1 + 1;

     }

else if (dropdown1.rawValue == "2")

     {

          total2 = total2 + 1;

     }

else if (dropdown1.rawValue == "3")

     {

          total3 = total3 + 1;

     }

else

     {

          total4 = total4 + 1;

     }

//"the script above shoudl be repated for all dropdown lists"

hiddenfieldTotal1.rawValue = total1;

hiddenfieldTotal2.rawValue = total2;

hiddenfieldTotal3.rawValue = total3;

hiddenfieldTotal4.rawValue = total4.