Count Checkboxes with Gravity Forms

三世轮回 提交于 2019-12-20 05:38:51

问题


I'm making a form that is for a summer camp registration form where users will be registering. By the end of the form there is an option of paying in full or making a $50 deposit for each camp selected. I'm using hidden products to handle the total amount per week and adding their value into the total. My question comes if I can use formulas to count the number of checkboxes that have been selected and do the calculations.

Example:

Week 1:

  • Soccer camp

Week 2:

  • Computer camp

Total: $100 (Deposit)


回答1:


I actually have a snippet for this:

https://gist.github.com/spivurno/077fd21a993e9b573d46

Updated: https://gist.github.com/spivurno/a14ef4a18f57d0c67811e1b4d8791781

The parameters are:

  • form_id the ID of the form for which you would like to count the checkboxes
  • count_field_id the ID of the field into which you would like to populate the checkbox count (you can then use this field's merge tag in a Calculation formula)
  • checkbox_field_ids an array of Checkbox field IDs whose checkboxes should count towards the checkbox count (when checked)


来源:https://stackoverflow.com/questions/34956751/count-checkboxes-with-gravity-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!