Maybe this is old news to everyone, but I discovered something odd about date fields in VFE.
When the user enters data into the field, no validation takes place to ensure that what was entered is actually a date. Date fields seem to accept any collection of numbers, slashes and hyphens up to 10 characters long. I could type 1/56/2013 or 37////220, and the system is just fine with it.
How ridiculous is that? I discovered this problem when an invalid date caused one of my crystal reports to crash.
Anyone else encountered this?
Whenever I need to ensure a real date in VFE I use this, its not perfect (will allow February 30) but its close enough to find almost all user mistakes. You could use it to warn users or clear fields with invalid dates or both. It would be nice if GE just fixed it though.
{fn fnValidDate(field){
if (size(field) == 10) then
if (sub(field,3,1)=="/") then
if (sub(field,6,1)=="/") then
if match("01",sub(field,1,1))>0 and match("0123456789",sub(field,2,1))>0 then
if match("0123",sub(field,4,1))>0 and match("0123456789",sub(field,5,1))>0 then
if match("12",sub(field,7,1))>0 and match("901",sub(field,8,1))>0 and match("0123456789",sub(field,9,1))>0 and match("0123456789",sub(field,10,1))>0 then
return "T"
endif
endif
endif
endif
endif
endif
return "F"
}}