Reg Exp
Web Design
Notes Client
Checking for Empty Date field
Let's say you have an application with a field called DueDate that may or many not have a value assigned. In traditional Notes development, it is pretty easy to check for an empty date field. You can simply do:@If(DueDate != ""; ...
In XPages, the strict type-checking won't allow you to do that. Instead, this is what works for XPages:
var temp:java.util.Vector = doc.getItemValue("DateDue");
if (typeof temp.elementAt(0) != "lotus.domino.local.DateTime"){

As an addendum....

I discovered a situation that triggered an error using the above code. The situation was an empty date field. So I've changed my code to check for an empty date field:
// Return true if the field in the passed-in document is a date field
function isDateField(doc, fieldName) {
    if (!doc.hasItem(fieldName)) return false;
    var temp:java.util.Vector = doc.getItemValue(fieldName);
    if (temp.size() == 0) {
        return false;
    } else if (typeof temp.elementAt(0) == "lotus.domino.local.DateTime") {
        return true;
    } else {
        return false;