For a recent project I had to determine the most commonly selected answer/value in a quiz submission. This quiz was built using Gravity Forms, so I added a custom merge tag that calculates the most common value in the submission array. This is useful for Buzzfeed-style personality quizzes, example: if you selected mostly ‘pony’ value answers you are a pony.
Once this information is available as a merge tag you can display conditional badges for each result.
Your code seems fantastic. Thank you so much for sharing! Would I need to add this in functions.php file?
You know there is one thing you don’t with Gravity Forms quiz addon and that is sharing your result “I am pony” on social media. It would have been great if it did.
Hi! I put the gistfile1.php code in the functions.php. Where do you put the code in the gistfile2.txt?
Hi Therry, second bit can go into your form’s confirmation.
I see. So do I have to add a hidden field named “most_common”? And use that in the confirmation? Or paste that code somewhere?
The code you pasted into functions adds a custom merge tag you can use in the form confirmation and notification emails. This screenshot shows where the merge tag dropdown is: https://developer.gravitypdf.com/app/uploads/sites/2/2014/11/accessing-mergetags.png
Thank you so much Alicia! Got it working! You are the best! 😀
What does 10, 4 represent though in the add_filter?
So funny Becky we must have been looking at each other's pages at the same moment in time…I love love love your beautiful pillow. The lace emmihleslbent is gorgeous and so is your sweet tag!Sending you my best wishes for a good weekend x Kerry
ma quanto scrivete? (vi leggo dopo che c’ho un’età )cmq mi preme dirlo:Flavià stai rubando nel mio cuore il posto che è sempre stato di Makcioppo bravo(Mak se mi passi un deca sotto banco ti rimetto a tuo posto, eheheh)
I would like to ask if we have two most common answer we can give 2 answers?
Hi,
How can I add categories to a GF quiz so I can calculate not only total quiz scores (% and points) but also scores for each category (% and points) – for example: Introversion 78% and Emotional stability 67% or points.
How can I achieve this with GF?
Thank you!