I have a simple validation that I want to perform. Let's take for example one field, with the following simple validation requirement:
- the field is only required if a certain set of conditions is set
- if the user forgets to enter something in the field, a custom error message should be displayed in the <xp:messages> area
I think I have the following 3 options to perform this validation
1) Use the "required" property, which allows me to use a formula.
Pro: We can dynamically calculate if the field is required or not
Con: Generates a default error, which can't be changed
2) use a <xp:validateRequired>
Pro: Can display a custom error message
Con: Is not dynamic (value is always required)
3) use a <xp:validateExpression>
Pro: Can display a custom error, and allows me to check dynamically if the field is required
Con: Does not fire when the field is empty
How am I supposed to handle such a simple validation in XPages? This is driving me nuts ...