List Answers Unordered such as List of Countries
Hi Josh,
this is not something possible natively with HD Quiz. However, if you wanted to go on a coding adventure, it would be possible to create something like this.
A big goal of mine for the 2.x.x of HD Quiz is to make it “easy” for developers to extend HD Quiz with new question types. For example, I already have a filter called hdq_add_question_type
that allows you to add new question types to the dropdown list. But for now, the entire process is still in active development.
Just to be clear, I am not particularly recommending this, just putting it out there as an option if you were willing to put in the work.
The best way to do this would be the following IMO.
If you look at the Secret Settings of the documentation page, you will see there is a definition you can add called HDQ_MAX_ANSWERS
. This allows you to change the default 10 answers per question to any other number you want. For example, 44
.
Now you create 44 identical questions, all to the “text based answers” question type. Set each of the answers as one of the possible countries.
Great! Now you have 44 questions, where a user can enter one country per question. Now, the problem is that there is nothing stopping a user from entering the same country for each question. And this is where from a coding perspective things get more complicated.
For that question type, the available answers are stored in a custom data-attribute. What you’d need to do is also have the “immediately mark” setting enabled. This is so that every time a question is answered, we can run a custom JS function that will loop through each question and remove the answer from the pool. This will stop repeat countries.
Now the only challenge left is to not allow “incorrect” answers to be submitted. To do this… you know what. Just wait for the ability to add custom question types haha. It would obviously still require code, but would at least be better than forcing existing question types to do something new.
Oh Dylan, thank you for this beautiful response. I won’t claim to be super competent in PHP or JavaScript but I know some things such as loops, accessing arrays, concatenating, switches, appending things, writing basic functions, ect. I love the logic here and imagine using the CVS import will really come in handy for a quiz that has 100 places to prevent needing to write 10,000 answers for 100 questions. I’ve written jQuery things such as the following that added predefined search values to an advanced search on click:
$(“#activity-hiking”).click(function(){
$(‘#Search .activities’).append(‘Hike’).trigger(‘change’);
});
Good to know regarding the “Immediately mark answer as correct” option. I bookmarked this discussion and placed it in my task notes along with bookmarking the email. Absolutely brilliant way of addressing the repeat countries. I’ll wait for the ability to add custom question types and very much look forward to this. I’m a little stronger with PHP than JavaScript but this would be the perfect encouragement to study more JS the mean time. 🙂
Warm regards and happy holidays,
Josh
Respond to thread
You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.
Submit
Howdy, I carefully read the documentation twice and searched through the forums before posting. Lots of great info. 🙂
Is there any way in HD Quiz to create a quiz that allows the quiz taker to list off items such as “Countries of Europe”? A sort of answer bank. There are 44 countries which I’m guessing would require creating 44 questions. But each question is tied with a specific answer. I don’t see a way for the quiz taker to list off countries off the top of their head or an intuitive way for them to type out each country. I linked to a quiz example that allows you to type country names without having to worry about order. I picked a cliche example, but in reality I’d have quiz’s such as “Highest 100 Peaks in Colorado”.
Warm regards,
Josh