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.

conditional logic based on value of hidden field

  1. rdingus


    I have a multi-page form I am building here:

    The form collects user info then presents a series of radio button "quiz" questions. I then calculate a quiz score using gform_pre_submission and set that value on a hidden field called "Quiz Score". On the next page of the multi-part form I need to then do two things based on the value in this hidden field, before the form is submitted:
    1) Display the value in the hidden field like "You scored {hidden field value} out of 10".
    2) If the score is 10, display two additional checkbox form fields.

    After this, then submit the form and display a confirmation page.

    How can I do this?

    Posted 11 years ago on Sunday February 3, 2013 | Permalink
  2. rdingus

    Ok, I got #2 working by using gform_pre_render rather than gform_pre_submission to calculate and set the quiz score on a hidden field.

    For #1, do I need to create a shortcode to retrieve and display this hidden value on the final page of the form?

    Posted 11 years ago on Sunday February 3, 2013 | Permalink
  3. You want to display the score before the form is submitted in the same form? You mention using gform_pre_render, but I can't follow how you would use that to calculate the score before the form is rendered. Can you share the code you're using in your functions, and share how you are calculating the score currently? Thank you.

    Posted 11 years ago on Monday February 4, 2013 | Permalink