Krlos

Simple quiz form

Recommended Posts

Hi, need to implement a simple quiz form with 10 questions. Yes/No answers.

Someone has tried something similar?

I had thought to do it with fields, but wich fields? repeaters?

I'm not a processwire expert so maybe I'm not seeing something obvious.

Thank you.

 

 

Share this post


Link to post
Share on other sites

I have done something like this but this was in Spring Framework and not Processwire, you don't really need fields to do this ( This is my issue with using PW,it's easier for me to translate logic to classes than fields and pages).

 

What i did was to create different Object in Java and created an interface to make things easier so you have your MultiChoice Class, True or False Class, Open End Question class , all i needed to do was return a JSON that had enough meta-data to inform the UI what to render on the frontend and based on the question type it would generate the control to display the question and save the answer to a QuizManager which stores the question id and the answer for each quiz.

Share this post


Link to post
Share on other sites

Hi, yes you can work with simple repeaters for all questions of a form.

For yes/no answers you can use a pagefield or fieldtypeoptions (pagefield would be more flexible if you need more features)...

So you could render the form inputfields from the repeater field on frontend.

You are on the right track.

Best regards mr-fan

  • Like 2

Share this post


Link to post
Share on other sites

There are also a few javascript based wizards you could use, such as jquery smart wizard, steps, form to wizard, etc. Depending on your needs, you can use processwire to create the appropriate data for whichever wizard, and then save and track the results.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, mr-fan said:

For yes/no answers you can use a pagefield or fieldtypeoptions (pagefield would be more flexible if you need more features)...

So you could render the form inputfields from the repeater field on frontend.

I like the sound of this. Could you possibly elaborate a bit? Do you mean literally having one page called 'Yes' and one called 'No'?

Ot the questions themselves would each be a page in a repeater field?

Share this post


Link to post
Share on other sites

First one...you could build a tree branch like:

-questions_options
--yes
--no
--don't care
--could be changed...later

and use a reapeaterfield for your questions...so you can "use" this kind of quiz on every page/template you need it...

in the repeaterfield you setup your questions in the simplest mode with a textfield and a pagefield (using the question_options childpages...) to set the right answer - rendering on frontend is obvious with a simple foreach i think.

tricky would be to save the entries from users....this would be more complex...;)

  • Thanks 1

Share this post


Link to post
Share on other sites
22 hours ago, rick said:

There are also a few javascript based wizards you could use, such as jquery smart wizard, steps, form to wizard, etc. Depending on your needs, you can use processwire to create the appropriate data for whichever wizard, and then save and track the results.

I've been googling around and found these two as well:

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.