Open edX® Tutorial: How to add an open-ended text input question.
Before you can add content components into your course you need to add Sections, Subsections and Units. If you don’t know how to do that yet, you can learn how to do this in our previous tutorial titled How to Add Course Sections and Subsections.
In this tutorial you will learn how to add your first Unit into the course then add an open-ended text input component inside that Unit.
Note: If you already know how to add Units into your course, you can go directly to Step 3 below.
Step 1: Navigate to the course Outline from inside Studio.
In order to access the course Outline page, you first need to sign into Studio. From the Studio Home where all your courses are listed, click the course name of the course you want to enter. In the below image the course name is indicated as “Demonstration Course”, just click that to go inside the course to the course Outline.
Image: A screenshot of the Open edX Studio Home page.
When you click the course name, you will immediately be taken to the course Outline, as shown in the below image.
Image: A screenshot of the course Outline in Studio with the Section and Subsection you added in our previous tutorial How to Add Course Sections and Subsections.
Step 2: From the course Outline, click the + New Unit button
When you click the blue + New Unit button the system will automatically generate a new Unit for you. Go ahead and click it and the Unit will open up in a new page making it easier for you to develop that Unit.
Image: A screenshot of the new Unit created by the system.
Step 3: From the new Unit, click the green Problem button to see a list of problem types.
When you click the green Problem button you will see a list of all the available problem types. This includes Text Input. Check out the below image showing all the common options. In order to build an open-ended text input question you start with a normal text input question. Go ahead and add a text input component into the Unit.
Image: A screenshot of the available common problem types with the Text Input highlighted.
Step 4: Click the Text Input option.
When you click the Text Input option the system will generate a template for you as shown in the below image.
Image: A screenshot of the Text Input template.
Step 5: Click Edit to edit the template.
Once you have the text input template generated, you need to edit it. You will see some instructions inside the template to guide you. However, instead of just using this template, you are going to learn the XML code to add inside the text input in order to turn it into an open-ended text input. This is the XML code, note the bold text which is the most vital parts of the code which will be explained more in detail later:
<label>Now that you have seen how often your words were chosen. Choose five (5) more words! Once you have submitted them, we will reveal to you a long list of words found in the Bible! Are your words among them?</label>
<stringresponse answer=”.*.” type=”ci regexp”>
So, where do you put this code in? It’s easy, what you need to do is to click the Advanced Editor button in the Editor. See the below images to locate this button. Don’t forget you need to click Edit to see the following screen.
Image: Screenshot of a normal text input template in Edit mode.
Image: Screenshot of the Advanced Editor button.
Step 6: Click the Advanced Editor button.
When you click the Advanced Editor button a warning will appear asking you if you are sure you want to switch to the Advanced Editor (this cannot be undone). Click OK proceed.
Image: Screenshot of the warning message.
Step 7: Change the template XML code with the new XML code provided to you above.
The normal template XML code will be present in the Advanced Editor. You need to replace this code with the code provided above. Below you can find before and after screenshots of the code being replaced.
When you are done editing the template, click Save to finalise it.
Image: Screenshot of the normal XML code that you need to replace.
Image: Screenshot of the new updated XML code needed to turn it into an open-ended text input question.
Let’s explain this XML code in detail:
The <problem> </problem> code wraps the whole question and indicated to the system that this is a problem (i.e. a question to solve).
The <label> </label> code is obviously for adding your own label or title to the question. You can add any text into this area in order to pose your question.
The <stringresponse> defines the accepted response from the learner. Inside the <stringresponse> tags you will see answer=”.*.” which indicates that any response may be inputted by the learner. The star (*) in XML means “anything or all”. So this problem accepts any response. To be more precise, the type=”ci regexp” declares that regular expressions (regexp) are allowed as inputs, and that it is case insensitive (ci).
Don’t forget that when you are done editing the template, click Save to finalise it.
Note: At any time you can click the Edit button again to make changes but you cannot revert back to the normal editor mode.