In this example, you have a text input box added to a page tied to a custom variable, “TypedResponse”. So what the learner types in the text input box is saved as the text string value for the variable “TypedResponse”.
You are expecting the learner to type in a specific text string. You'd like to show feedback based on what the learner types, providing feedback for correct and incorrect entries.
In this example, the learner was asked what the largest land animal in existence today is. The correct answer is "elephant".
On the question page, you want to show text feedback for two possibilities:
- If the answer is elephant
- If the answer is not elephant
For the first possibility, add a condition, {{TypedResponse}} == "elephant".
NOTE: Single or double quotes can be used, but we recommend you always use one or the other in individual condition statements.
Add the action to show the correct answer, and then add the variable to the conditions field:
- Right-click in the Conditions field
- In the search dialogue type, TypedResponse
- Select the variable, TypedResponse
- The variable string is now shown in the Conditions field
- Type == "elephant"
- At this point, you could stop, but if you want to account for variations in what the learner typed, your updated statement would be:
- {{TypedResponse}} == "elephant" || {{TypedResponse}} == "Elephant" || {{TypedResponse}} == "ELEPHANT"
This condition will look at what the user typed and will show the correct feedback if the typed answer matches any of the three strings. Yes, matches are case sensitive. The || symbol means "or".
For the incorrect answer, add the action to show the incorrect answer, and then add the variable to the conditions field:
- Right-click in the Conditions field
- In the search dialogue type, TypedResponse
- Select the variable, TypedResponse
- The variable string is now shown in the Conditions field
- Type != "elephant"
- At this point, you could stop, but if you want to account for variations in what the learner typed, your updated statement would be:
- {{TypedResponse}} != "elephant" && {{TypedResponse}} != "Elephant" && {{TypedResponse}} != "ELEPHANT"
This condition will look at what the user typed and will show the incorrect feedback if the typed answer matches any of the three strings. The && symbol means "and". In this case, we want to make sure that the answer is not equal to all three strings.
NOTE: If your use case is simply a fill in the blank question, our built-in fill in the blank practice/test question will provide this type of functionality automatically.
Confirm
Comments ( 0 )
Sign in to join the discussion.