Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Count Radio Buttons

Avatar

Level 3

Hello,

Sorry about all these questions I am writng lately, but I am still learning javascript and all of the programming that goes into this..  Anyway, I am filling out a form that requires users to fill in radio buttons.  Depending on the response of the radio button, the user has to include a picture.  I would like to be able to have specific radio buttons add up to give me a total number of pictures that need to be added.  So if they choose "Yes" for questions, 3, 5, 8, etc.  it will add up however many "Yes" responses there are.   I do not know if this is even possible, but it would be a nice touch to this...

Thoughts if this is possible?

Justin

3 Replies

Avatar

Level 8

Hey, six years ago I didn't know the difference between a pdf file and a pedophile. That's what this forum is for!

Yup. Pretty much anything is possible.

1) For all your radio button groups go to the Binding tab under your Object palette

2) Make sure Specify Item Values is checked

3) Assign yes with a value of 1 and No a value of 0

4) Create a numeric field and in your script editor add the following FormCalc script under the calculate event:

     a)If all your radio groups are named RadioButtonList: sum(RadioButtonList[*])

     b) If they all have different names, enter all the names separated by commas: sum(RadioButtonList1,RadioButtonList2,RadioButtonList3)

Now, I'm still working on a form that shovels my driveway. I'll let you know...;)

Kyle

Avatar

Level 3

Kyle,


Thanks for the reply and the words of incouragement.   I tried what you suggested, but for some reason, it did not work.  Is there a way to get a sample document of this?  I work better seeing than reading, if that makes sense.    I think I might have incorrectly made all of my radio buttons


Thanks .


Justin