If the field is editable, use the Validation Formula in the field code.
A Validation Formula is specifically designed to return either True or False. If False, the document does not save.
Be wary of putting code in the Validation section that is not designed to check if the document is to be saved. If your formula does something else, then it might not evaluate to True, which could prove difficult in debugging why the doc does not save.
To summarize : For an editable field,
* the Default formula is calculated once for a new document
* the Translation formula is calculated on each refresh and can change the value of the field
* the Validation formula is also calculated on each refresh, but is destined to check if the doc can be saved or not
The issue with the Validation formula is that, quite often, you only want to check it when the document is actually being saved. So, if you do not include an
@if(@IsDocBeingSaved.. in it, you'll end up with the check being done for each doc refresh. That could prove annoying for the user quite quickly (as in "why does it continually tell me I can't save when I haven't tried to ?").
For displaying the message, you can use @Return in your Validation formula.
A complete formula could look like this :
Code:
@if([i]fieldname[/i]="" & @IsDocBeingSaved;@Return("Please include a date of reception");@true)
Hope this helps,
Pascal.