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.

Building Quiz with GF -- Sum Checkbox Values?

  1. hyperhead
    Member

    Trying to build a GF quiz following your useful samples shown in http://www.gravityhelp.com/forums/topic/mathematics-to-gravity-forms

    That works beautifully for radio-button fields. I hit a wall, however, trying to incorporate checkbox fields with associated values. Here's a screenshot:
    https://skitch.com/rossteasley/en2pk/temp122314

    Trying to add up correct answers, the "score" field should increment by 1 for each choice checked within the checkbox field-id (with a value of 1). Currently, however, the "score" field is only incrementing by 1 for each field-id regardless of how many choices are checked by the user.

    For example, using the screen shot above, if the user checked all three choices with a value of 1, the "score" field still only increments by 1, when we need it to increment by 3 for this field-id before moving on the next field.

    Here is the current code in functions.php:
    https://gist.github.com/2981540

    Is it possible to have "score" step through each choice within each field to sum the values, then move on to the next field and keep adding to the "score" value until the quiz is complete?

    This quiz has 18 questions (18 field-ids). Most are checkboxes, but some are radio (yes/no) or (true/false). Here's a dev version of the quiz to look at:
    http://homexblogs.staging.wpengine.com/sample-page/

    Thanks for any advice anyone has!

    Posted 12 years ago on Sunday June 24, 2012 | Permalink
  2. You can actually do this now out of the box with Gravity Forms number and product field calculation types. Check out this post:
    http://www.gravityhelp.com/forums/topic/basic-form-calculation#post-62546

    Posted 12 years ago on Sunday June 24, 2012 | Permalink