Good Morning,
I have an InfoPath 2007 form (browser based) that presents application error messages to the user by showing/hiding expression boxes. Recently I had need to update the text in one of the error messages. My problem is that while the changed error message text appears in any new forms created by the user, the old error message text is shown when the user accesses an existing form. My understanding of InfoPath tells me that this sort of situation is managed by the upgrade.xsl file that is bundled in the xsn. So I opened up the upgrade.xsl and did some investigating.
Here's my original error message text:
cert2_actemra_recentuse_text = "The Most Recent Use Date must be a valid date."
Here's what I changed it to:
cert2_actemra_recentuse_text = "The Most Recent Use Date must be a valid date that is not in the future."
Here's the XSLT code that was generated in upgrade.xsl:
<xsl:element name="my:cert2_actemra_recentuse_text">
<xsl:choose>
<xsl:when test="my:cert2_actemra_recentuse_text">
<xsl:copy-of select="my:cert2_actemra_recentuse_text/text()[1]"/>
</xsl:when>
<xsl:otherwise>The Most Recent Use Date must be a valid date that is not in the future.</xsl:otherwise>
</xsl:choose>
</xsl:element>
Now I don't pretend to be an expert in XSLT so I ran it through the XSLT debugger in Visual Studio (2008) using XML from an existing form as input. I expected the code to branch to the "otherwise" and use the error message text contained therein. However, that is not the case - it executes the "copy-of" statement and then proceeds to the next element. The end result is that I get the original error message text instead of the new error message text.
THE XSLT appears to say: "if you find an element named 'cert2_actemra_recentuse_text' then use its value, otherwise use "The Most Recent Use Date must be a valid date that is not in the future.". In effect, it appears that InfoPath is generating the wrong XSLT for the given situation. The XSLT should be configured so that it unconditionally replaces the value of cert2_actemra_recentuse_text with the new value.
I expect the workaround here will be to delete the error message entirely and create another with a slightly different name that has the correct error message text in it.
Any takers on why this might have happened and how I might avoid it in the future?
Thanks in advance for any feedback.
\cbf