Note
EdX offers full support for this problem type.
The text input problem type is a core problem type that can be added to any course. At a minimum, text input problems include a question or prompt and a response field for free form answer text. By adding hints, feedback, or both, you can give learners guidance and help when they work on a problem.
For more information about the core problem types, see Working with Problem Components.
In text input problems, learners enter text into a response field. The response can include numbers, letters, and special characters such as punctuation marks. Because the text that the learner enters must match the instructor’s specified answer exactly, including spelling and punctuation, edX recommends that you specify more than one correct answer for text input problems to allow for differences in capitalization and typographical errors.
In the LMS, learners enter a value into a response field to complete a text input problem. An example of a completed text input problem follows.
To add the example problem illustrated above, in Studio you use the simple editor to enter the following text and Markdown formatting.
>>What was the first post-secondary school in China to allow both male and female students?||Answer with a name from the modern period.<<
= Nanjing University
or= National Central University
or= Nanjing Higher Normal Institute
or= Nanking University
[explanation]
Nanjing University first admitted female students in 1920.
[explanation]
The OLX (open learning XML) markup for this example text input problem follows.
<problem>
<stringresponse answer="Nanjing University" type="ci">
<label>What was the first post-secondary school in China to allow both
male and female students?</label>
<description>Answer with a name from the modern period.</description>
<additional_answer answer="National Central University"/>
<additional_answer answer="Nanjing Higher Normal Institute"/>
<additional_answer answer="Nanking University"/>
<textline size="20"/>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>Nanjing University first admitted female students in 1920.</p>
</div>
</solution>
</stringresponse>
</problem>
For the text input problems in your course, you can use edX Insights to review aggregated learner performance data and examine submitted answers. For more information, see Using edX Insights.
You add text input problems in Studio by selecting the Problem component type and then using either the simple editor or the advanced editor to specify the prompt and the acceptable answer or answers.
Note
You can begin work on the problem in the simple editor, and then switch to the advanced editor. However, after you save any changes you make in the advanced editor, you cannot switch back to the simple editor.
When you add a text input problem, you can choose one of these templates.
These templates include the Markdown formatting that you use in the simple editor to add a problem without, or with, hints and feedback.
To use the simple editor to add a problem, follow these steps.
In the unit where you want to create the problem, under Add New Component select Problem.
From the list of Common Problem Types, select the type of problem you want to add. Studio adds a template for the problem to the unit.
Select Edit. The simple editor opens to a template that shows the Markdown formatting that you use for this problem type.
Replace the guidance provided by the template to add your own text for the question or prompt, answer options, explanation, and so on.
To format equations, you can use MathJax. For more information, see Using MathJax for Mathematics.
Select Settings to provide an identifying Display Name and define settings for the problem. For more information, see Defining Settings for Problem Components.
Select Save.
You can use the advanced editor to identify the elements of a text input problem with OLX. For more information, see Text Input Problem XML Reference.
To use the advanced editor to add a problem, follow these steps.
Follow steps 1-3 for creating the problem in the simple editor.
Select Advanced Editor. The advanced editor opens the template and shows the OLX markup that you can use for this problem type.
Replace the guidance provided by the template to add your own text. For example, replace the question or prompt, answer options, and explanation.
To format equations, you can use MathJax. For more information, see Using MathJax for Mathematics.
Update the OLX to add optional elements and attributes required for your problem.
Select Settings to provide an identifying Display Name and define settings for the problem. For more information, see Defining Settings for Problem Components.
Select Save.
You can specify more than one correct response for text input problems. For example, instead of requiring learners to enter an answer of “Dr. Martin Luther King, Junior” exactly, you can also allow answers of “Martin Luther King, Jr.” “Doctor Martin Luther King,” and other variations. To do this, you can use the simple editor or the advanced editor.
To specify additional correct responses in the simple editor, include
or=
before each additional correct response.
>>What African-American led the United States civil rights movement during the 1960s?<<
=Dr. Martin Luther King, Jr.
or=Dr. Martin Luther King, Junior
or=Martin Luther King, Jr.
or=Martin Luther King
To specify an additional correct response in the advanced editor, within the
<stringresponse>
element add the <additional_answer />
element with an
answer=""
attribute value.
<problem>
<stringresponse answer="Dr. Martin Luther King, Jr." type="ci" >
<label>What African-American led the United States civil rights movement during the 1960s?</label>
<additional_answer answer="Dr. Martin Luther King, Junior"/>
<additional_answer answer="Martin Luther King, Jr."/>
<additional_answer answer="Martin Luther King"/>
<textline size="30"/>
</stringresponse>
</problem>
For an overview of feedback in problems, see Adding Feedback and Hints to a Problem. In text input problems, you can provide feedback for the correct answer or for a specified incorrect answer. Use feedback on incorrect answers as an opportunity to address common learner misconceptions. Feedback for text input questions should also provide guidance to the learner on how to arrive at the correct answer.
If you define multiple correct responses for the question, you can define feedback for each response.
You can configure feedback in the simple editor. When you add a text input problem, select the template Text Input with Hints and Feedback. This template has example formatted feedback that you can replace with your own text.
In the simple editor, you configure feedback for a text input problem with the following Markdown formatting.
=Correct Answer {{Feedback for learners who enter this answer.}}
not=Incorrect Answer {{Feedback for learners who enter this answer.}}
For example, the following problem has feedback for the correct answer and two common incorrect answers.
>>What is the largest state in the U.S. in terms of land area?<<
=Alaska {{Alaska is the largest state in the U.S. in terms of not only land
area, but also total area and water area. Alaska is 576,400 square miles,
more than double the land area of the second largest state, Texas.}}
not=Texas {{While many people think Texas is the largest state in terms of
land area, it is actually the second largest and contains 261,797 square
miles.}}
not=California {{California is the third largest state and contains 155,959
square miles.}}
In the advanced editor, you configure answer feedback with the following syntax.
<problem>
<stringresponse answer="Correct Answer" type="ci">
<label>Question text</label>
<correcthint>Feedback for the correct answer</correcthint>
<stringequalhint answer="Incorrect Answer">Hint for the incorrect answer</stringequalhint>
<textline size="20"/>
</stringresponse>
</problem>
For example, the following problem has feedback for the correct answer and two common incorrect answers.
<problem>
<stringresponse answer="Alaska" type="ci">
<label>What is the largest state in the U.S. in terms of land area?</label>
<correcthint>Alaska is the largest state in the U.S. in terms of not
only land area, but also total area and water area. Alaska is 576,400
square miles, more than double the land area of the second largest
state, Texas.</correcthint>
<stringequalhint answer="Texas">While many people think Texas is the
largest state in terms of land area, it is actually the second
largest and contains 261,797 square miles.</stringequalhint>
<stringequalhint answer="California">California is the third largest
state and contains 155,959 square miles.</stringequalhint>
<textline size="20"/>
</stringresponse>
</problem>
By default, the feedback labels shown to learners are Correct and Incorrect. If you do not define feedback labels, learners see these terms when they submit an answer, as in the following example.
Incorrect: California is the third largest state and contains 155,959 square
miles.
You can configure the problem to override the default labels. For example, you can configure a custom label for a specific wrong answer.
Close but wrong: California is the third largest state and contains 155,959
square miles.
Note
The default labels Correct and Incorrect display in the learner’s requested language. If you provide custom labels, they display as you define them to all learners. They are not translated into different languages.
In the simple editor, you configure custom feedback labels with the following syntax.
not=Answer {{Label:: Feedback}}
That is, you provide the label text, followed by two colon (:) characters, before the feedback text.
For example, the following feedback is configured to use a custom label.
not=Texas {{Close but wrong:: While many people think Texas is the largest
state in terms of land area, it is actually the second largest of the 50 U.S.
states, containing 261,797 square miles.}}
In the advanced editor, you configure custom feedback labels with the following syntax.
<correcthint label="Custom Label">Feedback</correcthint>
<stringequalhint answer="Incorrect Answer" label="Custom Label">Feedback</stringequalhint>
For example, the following feedback is configured to use custom labels.
<correcthint label="Right you are">Alaska is the largest state in the U.S.
in terms of not only land area, but also total area and water area. Alaska
is 576,400 square miles, more than double the land area of the second
largest state, Texas.</correcthint>
<stringequalhint answer="Texas" label="Close but wrong">While many people
think Texas is the largest state in terms of land area, it is actually the
second largest of the 50 U.S. states containing 261,797 square miles.</stringequalhint>
You can add hints to a text input problem using the simple editor or the advanced editor. For an overview of hints in problems, see Adding Feedback and Hints to a Problem.
In the simple editor, you configure hints with the following syntax.
||Hint 1||
||Hint 2||
||Hint n||
Note
You can configure any number of hints. The learner views one hint at a time and views the next one by selecting Hint again.
For example, the following problem has two hints.
||A fruit is the fertilized ovary from a flower.||
||A fruit contains seeds of the plant.||
In the advanced editor, you add the <demandhint>
element immediately before
the closing </problem>
tag, and then configure each hint using the
<hint>
element.
.
.
.
<demandhint>
<hint>Hint 1</hint>
<hint>Hint 2</hint>
<hint>Hint 3</hint>
</demandhint>
</problem>
For example, the following OLX for a multiple choice problem shows two hints.
.
.
.
</multiplechoiceresponse>
<demandhint>
<hint>A fruit is the fertilized ovary from a flower.</hint>
<hint>A fruit contains seeds of the plant.</hint>
</demandhint>
</problem>
You might want to include a word, phrase, or sentence after the response field in a text input problem to help guide your learners or resolve ambiguity.
To do this, you use the advanced editor.
In the problem, locate the textline
element. This element creates the
response field for the problem and is a child of the stringresponse
element. An example follows.
<problem>
<stringresponse answer="Ashmun" type="ci">
<label>What Pennsylvania school was founded in 1854 to provide
educational opportunities for African-Americans?</label>
<textline size="20"/>
</stringresponse>
</problem>
To add text after the response field, add the trailing_text
attribute
together with the text that you want to use inside the textline
element.
<problem>
<stringresponse answer="Ashmun" type="ci">
<label>What Pennsylvania school was founded in 1854 to provide
educational opportunities for African-Americans?</label>
<textline size="20" trailing_text="Institute"/>
</stringresponse>
</problem>
By default, text input problems do not require a case sensitive response. You can change this default to require a case sensitive answer.
To make a text input response case sensitive, you use the advanced editor.
In the advanced editor, the stringresponse
element has a type
attribute. By default, the value for this attribute is set to ci
, for “case
insensitive”. An example follows.
<problem>
<stringresponse answer="Paris" type="ci">
.
.
.
</stringresponse>
</problem>
Learners who submit an answer of either “Paris” or “paris” are scored as correct.
To make the response case sensitive, change the value of the type
attribute to cs
.
<problem>
<stringresponse answer="Paris" type="cs">
.
.
.
</stringresponse>
</problem>
Learners who submit an answer of “Paris” are scored as correct, but learners who submit an answer of “PARIS” are scored as incorrect.
By default, the response field for text input problems is 20 characters long.
You should preview the unit to ensure that the length of the response input field accommodates the correct answer, and provides extra space for possible incorrect answers.
If the default response field is not long enough, you can change it using the advanced editor.
In the advanced editor, the textline
element has a size
attribute. By
default, the value for this attribute is set to 20
. An example follows.
<problem>
<stringresponse answer="Democratic Republic of the Congo" type="ci">
.
.
.
<textline size="20"/>
</stringresponse>
</problem>
To change the response field length, change the value of the size
attribute.
<problem>
<stringresponse answer="Democratic Republic of the Congo" type="ci">
.
.
.
<textline size="40" />
</stringresponse>
</problem>
You can configure a text input problem to allow a regular expression as an answer. Allowing learners to answer with a regular expression can minimize the number of distinct correct responses that you need to define for the problem: if a learner responds with the correct answer formed as a plural instead of a singular noun, or a verb in the past tense instead of the present tense, the answer is marked as correct.
To do this, you use the advanced editor.
In the advanced editor, the stringresponse
element has a type
attribute. You can set the value for this attribute to regexp
, with or
without also including ci
or cs
for a case insensitive or case
sensitive answer. An example follows.
<problem>
<stringresponse answer="string pattern" type="regexp ci">
.
.
.
</stringresponse>
</problem>
The regular expression that the learner enters must contain, in whole or in part, the answer that you specify.
In this example, learners who submit an answer of “string pattern”, “String Patterns”, “string patterned”, or “STRING PATTERNING” are all scored as correct, but learners who submit an answer of “Strings Pattern” or “string patern” are scored as incorrect.
<problem>
<stringresponse answer="Correct answer 1" type="ci regexp">
<label>Question text</label>
<description>Optional tip</description>
<correcthint>Provides feedback when learners submit the correct
response.</correcthint>
<additional_answer answer="Correct answer 2"/>
<additional_answer answer="Correct answer 3"/>
<stringequalhint answer="Incorrect answer 1">Provides feedback when
learners submit the specified incorrect response.</stringequalhint>
<stringequalhint answer="Incorrect answer 2">Provides feedback when
learners submit the specified incorrect response.</stringequalhint>
<textline size="20" />
</stringresponse>
<demandhint>
<hint>The first text string to display when learners request a hint.</hint>
<hint>The second text string to display when learners request a hint.</hint>
</demandhint>
</problem>
For text input problems, the <problem>
element can include this
hierarchy of child elements.
<stringresponse>
<label>
<description>
<additional_answer>
<correcthint>
<stringequalhint>
<textline>
<solution>
<demandhint>
<hint>
In addition, standard HTML tags can be used to format text.
<stringresponse>
¶Required. Indicates that the problem is a text input problem.
Attribute | Description |
---|---|
answer (required) |
Specifies the correct answer. Note that if you do not also add the |
type (optional) |
Specifies whether the problem requires a case sensitive response and if it allows regular expressions.
You can also combine these values in a space separated list. For
example, |
<label>
<description>
<textline>
<additional_answer>
<correcthint>
<stringequalhint>
<solution>
<label>
¶Required. Identifies the question or prompt. You can include HTML tags within this element.
None.
None.
<description>
¶Optional. Provides clarifying information about how to answer the question. You can include HTML tags within this element.
None.
None.
<textline>
¶Required. Creates a response field in the LMS where the learner enters a text string.
Attribute | Description |
---|---|
size |
Optional. Specifies the size, in characters, of the response field in the LMS. Defaults to 20. |
hidden |
Optional. If set to “true”, learners cannot see the response field. |
correct_answer |
Optional. Lists the correct answer to the problem. |
trailing_text |
Optional. Specifies text to appear immediately after the response field. |
None.
<additional_answer>
¶Optional. Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
Attribute | Description |
---|---|
answer |
Required. The text of the alternative correct answer. |
<correcthint>
<correcthint>
¶Optional. Specifies feedback to appear after the learner submits a correct answer.
Attribute | Description |
---|---|
label |
Optional. The text of the custom feedback label. |
None.
<stringequalhint>
¶Optional. Specifies feedback to appear after the learner submits an incorrect answer.
Attribute | Description |
---|---|
answer |
Required. The text of the incorrect answer. |
label |
Optional. The text of the custom feedback label. |
None.
<solution>
¶Optional. Identifies the explanation or solution for the problem, or for one of the questions in a problem that contains more than one question.
This element contains an HTML division <div>
. The division contains one or
more paragraphs <p>
of explanatory text.
The following example shows the XML format with the <hintgroup>
element
that you could use in the past to configure hints for text input problems.
Problems using this XML format will continue to work in the edX Platform.
However, edX recommends that you use the new way of configuring hints
documented above.
<problem>
<stringresponse answer="Correct answer 1" type="ci regexp">
<label>Question text</label>
<additional_answer>Correct answer 2</additional_answer>
<additional_answer>Correct answer 3</additional_answer>
<textline size="20" />
<hintgroup>
<stringhint answer="Incorrect answer A" type="ci" name="hintA" />
<hintpart on="hintA">
<startouttext />Text of hint for incorrect answer A<endouttext />
</hintpart >
<stringhint answer="Incorrect answer B" type="ci" name="hintB" />
<hintpart on="hintB">
<startouttext />Text of hint for incorrect answer B<endouttext />
</hintpart >
<stringhint answer="Incorrect answer C" type="ci" name="hintC" />
<hintpart on="hintC">
<startouttext />Text of hint for incorrect answer C<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>