Enforcing specific characters in a <textEntryInteraction> is easy. All that needs to
be done is to set the patternMask attribute to a valid RegEx expression and we'll enforce that
expression. In your RegEx expression, you leave off the start line ^ and end line $ delimiters.
Here is a complete textEntryInteraction with a limit of 10 characters, placeholderText, and
a patternMask that restricts input to only alphabetic characters (no numeric characters permitted).
<textEntryInteraction expectedLength="10" patternMask="[A-Za-z]+"
placeholderText="foo~~Only 10 alphabetic characters permitted" responseIdentifier="RESPONSE"/>
...more description coming soon...
| Get Responses: | [ Click Get Responses ] |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/imsqti_v2p1.xsd"
adaptive="false" timeDependent="false"
identifier="textEntry-filtered" title="TextEntry with Filtering">
<responseDeclaration baseType="string" cardinality="single" identifier="RESPONSE">
<correctResponse>
<value>summer</value>
</correctResponse>
<mapping defaultValue="0">
<mapEntry mapKey="summer" mappedValue="1"/>
<mapEntry mapKey="Summer" mappedValue="0.5"/>
</mapping>
</responseDeclaration>
<responseDeclaration baseType="string" cardinality="single" identifier="RESPONSE1">
<correctResponse>
<value>1776</value>
</correctResponse>
</responseDeclaration>
<outcomeDeclaration baseType="float" cardinality="single" identifier="SCORE"/>
<itemBody>
<p>Identify the missing word in this famous quote from Shakespeare's Richard III.</p>
<blockquote>
<p>
Now is the winter of our discontent<br/>
Made glorious <textEntryInteraction expectedLength="10"
placeholderText="foo~~Only 10 alphabetic characters permitted" patternMask="[A-Za-z]+"
responseIdentifier="RESPONSE"/> by this sun of York;<br/>
And all the clouds that lour'd upon our house<br/>
In the deep bosom of the ocean buried.
</p>
</blockquote>
<p>
In what year did the American colonies declare their independence from
Britain? <textEntryInteraction class="baseline span1" expectedLength="4"
placeholderText="~~Enter a numeric value, no more than 4 digits" patternMask="[0-9]+"
responseIdentifier="RESPONSE1"/>
</p>
</itemBody>
</assessmentItem>
Identify the missing word in this famous quote from Shakespeare's Richard III.
Now is the winter of our discontent
Made glorious by this sun of York;
And all the clouds that lour'd upon our house
In the deep bosom of the ocean buried.
In what year did the American colonies declare their independence from Britain?