Calculate radio field values per page


I have a multi-page form with 4 radio fields per page.

Each radio field has 2 options (disagree & agree). Disagree has value 1 and agree has value 2.

I would like to add a hidden field on each page that calculates the total value based on the selection. For example: if a user selects ‘agree’ on each of the 4 fields, the total value of the hidden field should be 4 x 2 = 8.

Is there a way to get this working for each page separately?

Thanks in advance!

Hi Mel. Yes, you can do this. Add a Number field to each page, and enable the calculation. For the calculation, add up all the fields in that page of the form. I like to leave the field visible while testing, and then you can make it hidden visibility on the Advanced tab when you’re convinced it works.

You can do that same thing on all pages of the multi-page form.

If you have any questions about the setup, please let me know.

Hi Chris

Thank you, that is a workable solution. But is it also possible to write some php function to automate the calculation?

Hi Mel. Yes, of course. You could use the gform_pre_submission filter to perform your calculation, and populate a field in the form with the result:


I’m not sure how to get all selected radio field values per page with php (without manually inserting field ids).

I really appreciate any help in this. My php skills are not that advanced.

I’d recommend you to do it with hidden fields. Why do you want to do it with code? :thinking:

Anyway, you have 2 functions to get the values:

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