当表单上有复选框时,在表单与电子邮件收件人一起提交后,如果复选框被“选中/取消选中”,则电子邮件回复显示“true / false”。我们的员工认为它不是非常用户友好,因为“T / F”似乎更像是一个技术术语。
我们如何才能将其更改为“是”以进行检查,将“否”更改为未选中? “
版本:8.50 SP2(Build 8.5.0.356)
答案 0 :(得分:2)
那很有趣;我遇到了智能表单的相反问题,因为这些复选框存储在XML中,因为"是"和"不"。因此,我创建了这个扩展方法,用于将字符串值转换为布尔值。 " True"," 1"和"是"全部转换为true
值。
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);
}
}
您可能希望查看此文件:/workarea/controls/forms/template_buildDataValue.xslt
它在此文件中引用:/workarea/controls/forms/template_FormFieldValue.xslt
buildDefaultValue xslt有这个循环:
<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>
您应该可以在外部<xsl:when>
元素中添加另一个<xsl:choose>
元素,并测试您想要的特定$field/@basetype
。
这些文件来自v9.0工作区,但是自v8.5以来,表格电子邮件没有太大变化,所以希望这些文件对你来说至少非常相似。
此外,这篇文章可能有所帮助:Customize Ektron HTML Form Email Layout