I'm implementing "conditional" validation -- if the status of the submission isn't "Final" (i.e. it's the other status, "Draft"), then don't enforce validation.
This works for text fields when the status is "Draft". However, it's triggering validations for number fields -- I'm wondering how come and what the work around is.
<xp:inputText value="#{Report.PapersIdentified}" id="PapersIdentified" style="width:3em">
<xp:this.converter><xp:convertNumber type="number"></xp:convertNumber></xp:this.converter>
<xp:this.validators>
<xp:validateRequired message="Identified publications can't be blank"></xp:validateRequired> <!-- (1) -->
<xp:validateExpression message="Identified publications can't be blank"> <!-- (2) -->
<xp:this.expression>
<![CDATA[#{javascript:
if (getComponent("Status").getSubmittedValue() == "Final") {
return false;
}
else {
return true;
}
}]]></xp:this.expression>
</xp:validateExpression>
</xp:this.validators>
</xp:inputText>