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.

best practices for creating tests/quiz/self-assessment

  1. I've read a few posts about using Gravity Forms to create simple tests, quizes or for self-assessment. For over a year it has been mentioned that the team wants to add this feature, but nothing yet... So I'm wondering if we can compile a list of best practices and perhaps code samples so that others can get this working on their own sites.

    here are the related forum posts:
    http://www.gravityhelp.com/forums/topic/surveyquiz-options-i-can-sponsor-this-paul-dot-marsden-at-mac-dot-com
    http://www.gravityhelp.com/forums/topic/use-gf-for-self-assessment-type-quiz

    please post any advice you have (especially admins!) and I'll post as I uncover more.

    Posted 13 years ago on Tuesday July 12, 2011 | Permalink
  2. Here is what I came up with:
    http://pastebin.com/WKKND4Yc

    my client just needed multiple choice. so that's what this does, but it could be expanded to support other things i'm sure.

    I created a page template where I call the form using gravity_form( $quiz_id );
    and before the header you have to add gravity_form_enqueue_scripts($quiz_id, false);

    then in the form ensure you have two hidden fields labeled 'quiz' and 'correct', they can be placed anywhere in the form (only the label matters, the value can be empty.)
    Then in each quiz question check 'enable values' and set the value of the correct answer to 1, others set to 0. don't use other point systems.

    a nice feature is that the user can keep submitting the quiz until they get it right. and the quiz keeps their correct answers highlighted and clears their incorrect answers so they can try again. this is good enough for self assessment.

    a quiz centric plugin from Gravity would be much cleaner, but this works in a pinch for simple testing of multiple choice questions.

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  3. I tried this with my quiz and it worked out: thanks for posting the code.

    However the confirmation message at the end does something strange for me: following the message it posts the score as:

    Your score: 0%

    Your score: 0%

    Your score: 0%

    Your score: (actual score as percentage, e.g. 80%)

    The number of instances doesn't reflect the number of times the quiz has been taken: it always shows up exactly like this, with the first 3 lines showing 0%. I can't work out why.
    Also, is it possible to show the result as a raw number out of the total? e.g. 8/10, instead of a percentage.
    Finally, for me the quiz title (form title) and initial message appear again under the confirmation message and scores but I don't want them to appear again at all, however I can't work out how to make them disappear.

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink
  4. Tracey, can you post the code you're using the accomplish this (post it at pastebin.com or pastie.org), and also a link to the form in use? Thank you.

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink
  5. The code I'm using is the same as dwenaus posted here: http://pastebin.com/WKKND4Yc
    From memory I didn't make any changes.

    I didn't create a separate page template as I found that it's working in my default page template without any additional code.

    The form can be found at http://traceygrady.com/quiz.

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink
  6. here is the latest version, maybe it fixes the problem.
    http://pastebin.com/ruVWvET8

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink
  7. Thanks for posting a new version; unfortunately there's been no improvement though.

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink