使用重力形式计算复选框 [英] Count Checkboxes with Gravity Forms

查看:19
本文介绍了使用重力形式计算复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个用于用户注册的夏令营注册表.在表格的最后,您可以选择全额支付或为每个选定的营地支付 50 美元的押金.我使用隐藏产品来处理每周的总金额并将它们的价值添加到总数中.我的问题是我是否可以使用公式来计算已选中复选框的数量并进行计算.

示例:

第 1 周:

  • 足球训练营

第 2 周:

  • 计算机营

总计:100 美元(押金)

解决方案

我实际上有一个片段:

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

更新:https://gist.github.com/spivurno/a14ef4a18f581d07a178f587d81781b78181781b>

参数为:

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)

解决方案

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)

这篇关于使用重力形式计算复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆