PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Adding Values?

  1. Is it possible to add label values to come up with a total?

    Example Question: Is gravity form the best?
    Label: Yes Value: 1
    Label: No Value: 0

    Example #2 Question: Is gravity form the best?
    Label: Yes Value: 1
    Label: No Value: 0

    When form is completed, can the form add the values? So if I answer yes to both questions i would have a score of 2...

    Posted 12 years ago on Tuesday June 7, 2011 | Permalink
  2. Hi Muntz,

    It isn't available out of the box, but wouldn't be hard to add a little custom jQuery to handle this.

    1. Add a hidden field title score. We'll store our totaled score here later. Check the option to allow for dynamic population and add the parameter name: 'total-this' http://grab.by/aj0r
    2. Add a class "total-this" to any field that should be included in the total. The little script I wrote only supports multiple choice fields by default. Make sure the value is numeric. http://grab.by/aj0s
    3. Paste this snippet in your theme's functions.php file. You probably need to remove the opening <?php at the top of the pastie. It's just there to indicate that it is PHP code: http://pastie.org/2034295

    That should be it. This is a super simple script but you can hopefully use it as a base to build upon.

Posted 12 years ago on Tuesday June 7, 2011 | Permalink