0

I'd like to allow authors to add a multiple choice question to an entry.

To build the possible answers, they will create answers and mark one as the correct answer. I could then output these as radio boxes on the frontend and allow website users to choose one and get 'marked'.

Since there is only a single question (with multiple answers) per entry, I'd like to avoid using a form plugin (such as Sprout Forms, which may be able to support this).

Anything I've tried did not have the ability to mark one and only one answer as Correct. I first built a table with 'Answer' (plain text) and 'Correct?' (lightswitch) fields in each row; this allowed choosing multiple answers as Correct. I then turned it into a SuperTable and made the 'Correct?' field radio buttons...but could not get all the rows in the table to be a single set of radio buttons such that you could only choose one.

enter image description here

Any ideas? Creative ways of building this differently are welcome. Thanks in advance.

  • 1
    Maybe add number field? Number put in this number field would be number of correct answer. – piotrpog Jun 17 '19 at 19:02
  • Nice idea! Thanks. – userAW Jun 18 '19 at 1:03
1

There isn't a field type or plugin I know of that will let an admin choose only 1 correct answer.

One possibility would be to number the correct answer in another field like piotrpog suggests. I would argue this is possibly more confusing and brittle since an admin could accidentally update the answer choices without updating the correct answer field. The two fields aren't linked automatically.

I think it's pretty reasonable to ask admin's to only mark one choice as correct. You could also reinforce this in the field instructions. The lightswitch field makes it pretty easy to scan the column to make sure.

| improve this answer | |
  • For now I'm going to stick with the lightswitch but don't think it's a perfect solution (and therefore am upvoting your answer but not marking it as 'correct'). I try to build the system so that it does not allow the users to make mistakes. I will keep thinking...Thank you for your help. Perhaps someone else will still come up with a great idea. – userAW Jun 21 '19 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.