Hello,
I am attempting to create a form in which the submitter will select options from a checkbox field with points in the values fields. I would like to be able to total the values selected. Is this something possible through GF?
Hello,
I am attempting to create a form in which the submitter will select options from a checkbox field with points in the values fields. I would like to be able to total the values selected. Is this something possible through GF?
Hi Nina,
If I was tasked with this I would first search thru the published plugins for a ready solution. If none were found, I would write a small plugin to handle it.
Sorry Iâm not familiar enuf with the existing plugin library, so I canât help you there.
But if some custom code was needed, itâs quite a straightforward exercise:
For the form-page:
For the PHP plugin code:
The last step depends on what you want to do with the sumâŠ
One approach would be to swap out a placeholder value in a field (HTML or Single Line for example) with the generated sum value, which would then display the sum with the formâs output (page, email, PDF).
Hope this helps.
Yes, you can do this. In your checkbox field, tick the box âshow valuesâ and then give each option a unique value. Then, add a number field to the form, and tick the box âEnable Calculationâ. Then, for the formula, just sum all the options (using the drop down to insert the merge tags for each option.) The key is to use the :value
modifier with each option. When you insert a merge tag, it will look like this by default:
{First Choice:1.1}
Change it to look like this:
{First Choice:1.1:value}
For my form with field one having one checkbox field and three options in the field, this is my completed formula:
{First Choice:1.1:value}+{Second Choice:1.2:value}+{Third Choice:1.3:value}
Thank you very much for taking the time to answer my question! This is exactly what I needed to know!
Thank you for your reply, but unfortunately, I am not familiar with how to write a plugin, and this advice is over my head.