When there are checkboxes on the form, after the form is submitted with email recipients , the emailed response shows "true/false" if the checkbox is "checked/unchecked". Our staffs think it's not very user-friendly as "T/F" seems to be more of a technical term.
How could we change it to "Yes" for checked and "No" for unchecked respectively? "
Version: 8.50 SP2(Build 8.5.0.356)
That's funny; I had the opposite problem with smart forms because those checkboxes are stored in the XML as "yes" and "no". Consequently, I created this extension method for converting a string value into a boolean. "True", "1", and "yes" all convert to a true
value.
public static class StringExtensions
{
public static bool ToBoolean(this string str)
{
bool result;
if (str == null)
return false;
if (bool.TryParse(str, out result))
return result;
return str.Trim() == "1" || string.Equals(str, "yes", StringComparison.OrdinalIgnoreCase);
}
}
You'll probably want to look at this file: /workarea/controls/forms/template_buildDataValue.xslt
It is referenced from within this file: /workarea/controls/forms/template_FormFieldValue.xslt
The buildDefaultValue xslt has this loop:
<xsl:for-each select="$data">
<xsl:choose>
<xsl:when test="$field/@datalist">
<xsl:variable name="displayValue" select="$fieldlist/datalist[@name=$field/@datalist]/item[@value=normalize-space(current())]"/>
<xsl:choose>
<xsl:when test="$displayValue">
<xsl:copy-of select="$displayValue/node()"/>
</xsl:when>
<xsl:when test="string-length(normalize-space(.))=0">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="./node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$field/@basetype='calendar' or $field/@datatype='date'">
<xsl:call-template name="buildDate"/>
</xsl:when>
<xsl:when test="string-length(normalize-space(.))=0">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="$field/@basetype='textbox' or $field/@datatype='textarea'">
<pre style="white-space:pre;word-wrap:break-word;"><xsl:copy-of select="./node()"/></pre>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="./node()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">
<br />
</xsl:if>
</xsl:for-each>
You should be able to add another <xsl:when>
element inside the outer <xsl:choose>
element and test for the particular $field/@basetype
you want.
These files are from the v9.0 workarea, but form emails haven't changed much since v8.5, so hopefully the files are at least very similar for you.
Also, this post may be of help: Customize Ektron HTML Form Email Layout