Input Validation of a Date Field

Hi,

I have a date field on a form and would like to validate that it is at least 3 days after todays date… preferably using formula language.

I know this must be very simple but I just don’t know.

Thanks, Paul

Subject: Yes, it is simple

@If(@Adjust(@Today; 0; 0; 3; 0; 0; 0) <= DateField; @Success; @Failure(“DateField must be at least 3 days after today”))

Phil

Subject: Thanks!.. but

Thanks Phil,that was pretty much perfect!

One other thing though, after the 3 day message, I get another message “Notes Error - field didn’t pass validation formula”. Is there a way to stop this message?

Thank you very much, Paul

Subject: check that datefield is not blank

All good input validation formulae check that the field actually contains data. Mine didn’t! To avoid it continually checking before you’re ready, I’d change it to this.

@If(DateField = “”; @Success; @Adjust(@Today; 0; 0; 3; 0; 0; 0) <= DateField; @Success; @Failure(“DateField must be at least 3 days after today”))

The double error message you’re getting arises when you have a uidocument.refresh in the field events, as far as I remember. If you remove that, and add “automatically refresh fields” on the form properties, it gets rid of that. Alternatively, you can use error-handling to hide the second message as explained here:

Good luck,

Phil :slight_smile:

Subject: Perfect!

Thanks Phil, I really appreciate the help… you saved me lots of time having to figure it out myself!!!

Take care, Paul

Subject: You’re welcome, Paul.

Nice to know something I did on a Friday worked (for once)!Phil