HD Quiz

Need to send invoices?
Check out my new WordPress plugin HDInvoice
Limited time launch sale

Checking answer by clicking a button

Published: April 9, 2024
Support status: closed

I created a quiz here: https://ailabor.appsters.me/kviz-teszt-1/
The purpose of the quiz would be to ask questions, the user is expected to figure out the answer in head, but no need to write it in the box. If the user wants to see the answer, just clicks on a button and the answer gets visible. Is it possible to create with this plugin?

On the linked page it works this way: user has to input at least one character in the box and hit enter, than the answer gets visible. It is not exactly the way we need it.

Anyway if it stays like this, is it possible to wrap the text in multiple lines not in a single one? I increased the boxheigt already but the text still appears in one line.

I would be glad to buy the premium addon if that helps.

Thanks a lot,

thread author: Zita

Hi Zita,
I don’t think what you are asking for is possible -> at least not as requested. However, I do have some solutions for you.

HD Quiz uses a text input, which is a default HTML element that is single line only. Nothing can change this. This is why changing the height does not do anything except make it “taller”. You’d need to convert them into textarea inputs which allow for multiline ⇾ but this would make marking impossible as there is no way to validate the answers when using random multi lines.

If I’m guessing correctly, your issue isn’t really that it uses an input, but that once the question has been marked and shows the answer, you want THAT to be multi-lined because it will look better for your longer answers?

If so, there are two possible solutions.

The first require no code, but instead needs you to build your quizzes differently. Here are two ideas.

Instead of using the text based answers, use multiple choice. Make one of the answers something like “reveal the answer”. You can then use the “extra text” feature to add in the full answer. There is also a quiz setting “Always Show Incorrect Answer Text” which I’d recommend enabling. Since this “Extra text” section can contain any content including multiple lines, this will allow you to format it however you want.

You can kind of see an example of this with the HD Quiz demo. For the first question, answer “Real” to see the “Extra text” show for that question. This also prevents the unintuitive (but creative!) “you need to enter at least one character and press enter” issue.

The second option requires adding code to your site, but would involve adding a function to the hdq_init function of HD Quiz to convert all of your inputs to textareas. This would likely break the marking for a lot of it, but since it doesn’t seem like you are really needing a “score” or anything, this might work for you. I can provide code if you need to go down this path.

09 April 2024 — 14:15 support admin - Dylan

Wow, amazing! Thanks a lot for the quick and professional reply, now it looks fine! Thank you!

09 April 2024 — 14:51 thread author - Zita

Respond to thread

This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help

You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.