- Support
- Forums
- SimpleQuiz
- Extension Forums
- SimpleQuiz Forum
- Text Field with required as the only criteria
Text Field with required as the only criteria
- Steven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
9 months 3 weeks ago #1
by Steven
Text Field with required as the only criteria was created by Steven
Is it possible to make a text field question and have the criteria be "required" as in it just cannot be left blank, but not specifically evaluated against the answer field?
In the examples on the quiz questions configuration, there is an example of textarea with no specified answer, but when I tried it as a required field, in the results, the question always evaluates to wrong.
I'm using a plugin to require the field only under certain circumstances, and I can probably work around this by catching the response and setting the answer to be equal to the response, but it seems like there should be, or it would be helpful to have a notation for "required" as in just not blank, and perhaps a notation for not these exact words, but "must contain these words". That second is just a feature suggestion.
In the examples on the quiz questions configuration, there is an example of textarea with no specified answer, but when I tried it as a required field, in the results, the question always evaluates to wrong.
I'm using a plugin to require the field only under certain circumstances, and I can probably work around this by catching the response and setting the answer to be equal to the response, but it seems like there should be, or it would be helpful to have a notation for "required" as in just not blank, and perhaps a notation for not these exact words, but "must contain these words". That second is just a feature suggestion.
Please Log in or Create an account to join the conversation.
- Christopher Mavros
- Offline
- Administrator
9 months 2 weeks ago #2
by Christopher Mavros
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Replied by Christopher Mavros on topic Text Field with required as the only criteria
Hi Steven and thank you for posting.
I understand what you are saying, but I can't really imagine of a real world example question. Can you provide one?
I could probably implement a smart-text answer code, something like [not-blank] that would always evaluate to correct, if a value is posted.
I understand what you are saying, but I can't really imagine of a real world example question. Can you provide one?
I could probably implement a smart-text answer code, something like [not-blank] that would always evaluate to correct, if a value is posted.
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Please Log in or Create an account to join the conversation.
- Steven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
9 months 2 weeks ago #3
by Steven
Replied by Steven on topic Text Field with required as the only criteria
I can't imagine a textarea for an answer (because it holds more text) in which the exact verbatim "correct answer" could be known in advance, except of course if you asks something like, "What were John Smith's exact words in his interview on xx/xx/2024?" or "What is the exact opening paragraph of...?"
even on the text box answers,you limited to asking questions with one word answers, so I was thinking it would be beneficial to have 2 other options: Not blank, and Contains Word or words.
On our quiz, we are asking people if they know what kind of reservation they have? That was part of my efforts to make a plugin, now completed, to modify the answer to match what the person's actual reservation is. The next question asks, "If you are bringing a camper, please describe your exact setup and it's length. e.g. pickup truck with a 30 foot trailer total length 45 feet."
Putting that in the extra fields didn't really work for us and part of my plugin removes that question for camper who are "Tent Only", but I had to jump through some hoops to make the system evaluate whatever the user put in as the correct answer, AND, I had to also use a system of replacing commas with || and then switching them back because commas broke the evaluation process because you allow comma separated options for answers.
My suggestion would be to refactor it so that:
Thanks!
Steven
even on the text box answers,you limited to asking questions with one word answers, so I was thinking it would be beneficial to have 2 other options: Not blank, and Contains Word or words.
On our quiz, we are asking people if they know what kind of reservation they have? That was part of my efforts to make a plugin, now completed, to modify the answer to match what the person's actual reservation is. The next question asks, "If you are bringing a camper, please describe your exact setup and it's length. e.g. pickup truck with a 30 foot trailer total length 45 feet."
Putting that in the extra fields didn't really work for us and part of my plugin removes that question for camper who are "Tent Only", but I had to jump through some hoops to make the system evaluate whatever the user put in as the correct answer, AND, I had to also use a system of replacing commas with || and then switching them back because commas broke the evaluation process because you allow comma separated options for answers.
My suggestion would be to refactor it so that:
- Make it so, if the not radio/checkbox question is required but the answer field in the question is blank, and non-empty answer is correct.
- Make a notation like [contains]Blah Blah Blah[/contains] so that if, whatever is in the answer field contains "Blah Blah Blah", it will evaluate to correct.
- Use something other than commas to separate correct answer options on the not radio/checkbox questions, at least for text areas where it should be assumed longer text strings will be entered, so that commas can be in the answer, or add a means to escape commas in the answer.
Thanks!
Steven
Please Log in or Create an account to join the conversation.
- Christopher Mavros
- Offline
- Administrator
9 months 1 week ago #4
by Christopher Mavros
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Replied by Christopher Mavros on topic Text Field with required as the only criteria
I understand all your points.
Unfortunately, changing existing setup like commas for multiple correct answers in text questions will bring up a lot of backwards compatibility errors for most existing installations.
Having commas in your expected correct answer would indeed separate it in two parts, as it is now.
From what I understand, what you have done with SimpleQuiz is probably closer to a reservation form.
Such fields should generally be placed in the extra fields, so that they do not affect the quiz scoring.
Having a non-empty and a 'contains-word' notation for correct answers is a good idea. I will note them down for implementation, but cannot guarantee exactly when or if they will be implemented.
Thanks again!
Unfortunately, changing existing setup like commas for multiple correct answers in text questions will bring up a lot of backwards compatibility errors for most existing installations.
Having commas in your expected correct answer would indeed separate it in two parts, as it is now.
From what I understand, what you have done with SimpleQuiz is probably closer to a reservation form.
Such fields should generally be placed in the extra fields, so that they do not affect the quiz scoring.
Having a non-empty and a 'contains-word' notation for correct answers is a good idea. I will note them down for implementation, but cannot guarantee exactly when or if they will be implemented.
Thanks again!
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Please Log in or Create an account to join the conversation.
- Steven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
9 months 1 week ago #5
by Steven
Replied by Steven on topic Text Field with required as the only criteria
I understand. I did not use the extra fields for a couple of reasons. We're only showing that question to certain users, and if it is shown to them we want it after a specific quiz question.
The one reason I would offer to taking on the comma in an answer issue is that, if you allow a textarea as an answer input field, it implies the ability for the respondent to write a more than one word answer, like a sentence, which often contain commas.
To maintain backward compatibility, you could take the same approach I used with my plugin. Rather than replace the separator for different possible answers in the component (the comma) instead tackle the issue from the other end: a) provide a means to escape commas in an answer, like the answer can be "this\, or that, those\, or these"; b) replace commas in the answer given by the quiz taker with something else like ||, and then replace the || back to a comma after the answer is evaluated.
The one reason I would offer to taking on the comma in an answer issue is that, if you allow a textarea as an answer input field, it implies the ability for the respondent to write a more than one word answer, like a sentence, which often contain commas.
To maintain backward compatibility, you could take the same approach I used with my plugin. Rather than replace the separator for different possible answers in the component (the comma) instead tackle the issue from the other end: a) provide a means to escape commas in an answer, like the answer can be "this\, or that, those\, or these"; b) replace commas in the answer given by the quiz taker with something else like ||, and then replace the || back to a comma after the answer is evaluated.
Please Log in or Create an account to join the conversation.
- Christopher Mavros
- Offline
- Administrator
9 months 1 week ago #6
by Christopher Mavros
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Replied by Christopher Mavros on topic Text Field with required as the only criteria
Theoretically, you could manage extra fields per quiz using your plugin. You could also add a custom <input> after the specific question, or even use the [option_text] feature that allows custom text for specific options.
The answer given by the quiz taker is not affected by the evaluation process. It is the correct answer that cannot contain commas at the moment, because they are interpreted as separators.
So I guess that escaping them is the proper way to go.
The answer given by the quiz taker is not affected by the evaluation process. It is the correct answer that cannot contain commas at the moment, because they are interpreted as separators.
So I guess that escaping them is the proper way to go.
Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!
Please Log in or Create an account to join the conversation.
Moderators: Christopher Mavros
- Home
- Support
- Forums
- SimpleQuiz
- Extension Forums
- SimpleQuiz Forum
- Text Field with required as the only criteria