cws
Greetings Guest
home > library > journal > view_article
« Back to Articles » Journal
Answer fields
0▲ 0 ▼ 0
How to use the markup answer fields.
This public article was written by Admin Sheep, and last updated on 23 Apr 2015, 06:37.

[comments] Menu
1. Text input
2. Drop down input
3. Options

For those of you with lesson articles, or who are thinking about making some, there is a CWS markup feature you can make use of (this will also work in the boards etc). It's the ability to quiz the user on their comprehension through use of questions and answers. The code is fairly simple as below.

If it's not working, please make sure you refresh your browser's cache with F5 or Ctrl+R.

[top]Text input

To make a text input, you just use the 'answer' tag with a simple string between. For example: <answer>Red</answer> will create this:

 

(Note: that this will accept Red, red, ReD, rEd, etc all as correct answers).

Multiple correct answers
You can specify multiple correct answers in the text input answers fields by using ',' to delimit the correct answers. For example, <answer>Red,Green</answer> will create this:

 

(Any variant of 'red' or 'green' will be accepted as answers).

[top]Drop down input

To make a drop down when you want to give more than one right answer, use | to delimit the options. For example: <answer>Red|Blue|White</answer> will create this:

 

(Note: in this instance, CWS will select the first one - 'Red' - as the correct answer).

If you wish to specify an option that is not first in the list as the correct option, prepend the answer with '+'. For example: <answer>Red|+Blue|White</answer> will create this:

 

(Blue is now the correct answer).

NOTE: multiple correct answers are not available with drop-down answer fields.

[top]Options

There are some options that are available for use with these. The options are denoted by '!' and must be placed at the END of the string. The options currently supported are:

!nobutton
This will hide the check button. This will make integration for things like close exercises much nicer.

!onetry
This will allow the person to only make one attempt. After the attempt is made, the user will be locked out from changing the field (even if they get it wrong).

An example:
<answer>Red|Blue|+Green!nobutton!onetry</answer>
 

!showanswer
This will show the correct answer if the user gets it wrong. This option will only work if: !nobutton is not turned on, and !onetry is turned on. Try putting something in the field below to see what the right answer should have been:
 
Comments (1)
[link] [quote] 13-Dec-15 09:04
Conlanger
CWS Conlanger
 TheRActivator
banana
privacy | FAQs | rules | statistics | graphs | donate | api (indev)
Viewing CWS in: English | Time now is 23-Mar-17 02:15