Problems, need help? Have a tip or advice? Post it here.
17 posts Page 2 of 2
Hello, I am using this advice to create a quiz. It really helps, but the difference is that I want to create multiple questions. So I made the quiz.php also clonable so each page is a question. But it doesn't show the pages the way results.php is now. What I have to change so I can list all of the questions on the frontend? Or maybe I can do it like that-the person answers a question, clicks on a "next" button and then the next question appear? Thank you for the great work.
Any help would be appreciated...
@iska123, it is, of course, doable but would be far more complex than the single-item example in this thread.
I'd love to help but am too busy at the moment to delve into anything of this complexity. My apologies.
@KK, why do you think it is complicated? Please consider my suggestion and see if it would work for the case.

The only tricky part is to create a valid JSON from the inputs upon submitting of the form. I think this can be done either by a JS script or PHP script. In theory, such script catches an array of inputs and traverses it to get the data to save into repeatable. OR question-answer Inputs may be named in a way to fake a bound repeatable field.

So, quiz.php is a clonable template, where each cloned page is a set of questions. Questions are represented by Mosaic. Admin can freely add any number of questions (each as a mosaic tile) per set (cloned page). Listing the questions also takes care of proper generation of the input names.

The results.php is a clonable template, where each page is a result for one user. It contains a repeatable region, which is dynamically populated via JSON, where each repeatable row is a question-answer pair. In such repeatable region, the number of rows is expected to dynamically match the number of questions in quiz.

I'd take a bite into creating such solution. In essense, it might become an example of using repeatable regions in a non-bound fashion in future.

I'd love to hear what way of solving the case you had in mind.
@trendoman, I had almost exactly the same solution in mind :)
By 'complicated', I meant something that would take a non-trivial amount of time to create - something I am not currently in a position to indulge in.

Please do go ahead and give it a go, as you mentioned it would indeed be a good example.
Thanks.
@KK, please check PM.
I am trying to use the way we did with the blog.php method, but somehow it shows only one of the pages that are cloned...
17 posts Page 2 of 2
cron