Default Text in Sakai Portfolio forms

Last night I was building a series of reflection forms for a large matrix (15 rows). Each reflection form had a rich text editor to hold the reflection.

The design of these reflection forms included some "default text" that would help to guide the student's thinking about their reflection. Each row of the matrix was to have slightly different default text in that field. There are two ways I could accomplish the task.

Default Text in the Renderer

Including the default text in the renderer (by replacing the field template with one that includes the desired default text), like this:

<textarea rows="30" cols="80" id="{$name}" name="{$name}">
    <xsl:choose>
    <xsl:when test="string($currentNode) = ''">
        <xsl:text disable-output-escaping="yes">&lt;h3&gt;Some Heading&lt;/h3&gt;
        &lt;p&gt;Some default text.&lt;/p&gt;</xsl:text>
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="$currentNode" disable-output-escaping="yes" />
    </xsl:otherwise>
    </xsl:choose>
</textarea>

I've seen other examples include default text in a form in this manner. Michigan's Page Composer does something similar by using 1 "main" stylesheet that includes most of the templates that is imported by a stylesheet that defaines the default text. If I did it that way, I would have 15 schemas and 15 renderers. Also, if I changed the default text (which may  influence the student's understanding of the reflection process), I wouldn't have a record of whuch students reflected using which prompts.

Define the Default Text in the Form Schema

Alternatively, I could place the default text in a piece of "documentation" about the reflection element:

<xs:element name="reflection" minOccurs="0" maxOccurs="1">
    <xs:annotation>
        <xs:documentation source="sakai.label">Please reflect on your work to date.</xs:documentation>
        <xs:documentation source="sakai.isRichText">true</xs:documentation>
        <xs:documentation source="sakai.defaultText">&lt;h3&gt;Some Heading&lt;/h3&gt;
        &lt;p&gt;Some default text.&lt;/p&gt;</xs:documentation>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:maxLength value="65535"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

and then replace the contents of an empty the rich text editor as such:

<textarea rows="30" cols="80" id="{$name}" name="{$name}">
    <xsl:choose>
    <xsl:when test="string($currentNode) = ''">
        <xsl:value-of select="$currentSchemaNode/xs:annotation/xs:documentation[@source='sakai.defaultText']" disable-output-escaping="yes"/>
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="$currentNode" disable-output-escaping="yes" />
    </xsl:otherwise>
    </xsl:choose>
</textarea>

I'm leaning towards the schema method for two reasons:

  • it would allow me to use just 1 renderer for all 15 forms.
  • the default text that I put in the schema is saved with the structured data when a student saves their reflection.

The "self-documenting" nature of forms can be used to do some sort of analysis down the road where one could compare the types of reflections that are written when one set of prompts are given against another set of prompts for the same reflection. Since I don't know what sort of questions may be asked of the data, I want to preserve the ability to ask at least that question. After all, when we change the other prompts (sakai.label), that is currently recorded, so why make this any different?