Complex Date Validations Made Simple

Here is the scenario:

"On your DatePicker, I desperately need the ability to have a start and end date picker, that I can set a value of Today + n days as the max date for StartDate, and then on the Endate + y days for a max on the EndDate."


1st Jan 2010 Is Today

StartDate: Max Start Date would be Today + N where N is 350 days.

EndDate: Beginning Date would be Startdate, Max for EndDate would be StartDate + Y. Where Y is 15 days.

So: 30th Dec 2010 would be OK as start date, and end date could be up to 14 Jan 2011.

How to do this in Simfatic Forms?

1. Add the Date Picker fields

First, add the date picker fields and name them as StartDate and EndDate.

Date picker fields

2. Add a calculation field DateDiffFromToday

We need to find out the days between today (the day on which the form is filled out) and the start date. Add a calculation field and name it say, DateDiffFromToday. We can use the calculation function days_from_today() .

The formula is:



2. Add another calculation field DateDiff

We need to find the number of days between StartDate and EndDate. Add a calculation field DateDiff and use the function days_between() in the formula.


days_between(Enddate, StartDate)

Date diff

We can make the calculation fields hidden if the value need not be shown to the user.

Hidden calculation field

3. Validations

First, StartDate should be after Today.

start date validation

Similarly, we can validate the EndDate to be after StartDate.

The StartDate should be within 350 days from the day the form is filled in. So the value of DateDiffFromToday (the calculation field) should be less than 350, but greater than 0.

validation date diff from today

The days between StartDate and EndDate should be less than 15.

Putting it together, we have all the validations this way:

all validations

You can download the sample form fwz (Simfatic Forms project) file here.

Good Article? Share it! Please?


which is the formula for the "AND"?


if the two checkboxes is checked, then the sum total of both ..

&& for AND

For example:

(chk1 && chk2 ) * sum


would not have been more fitting name for this tool !!!

Thx a lot Prasanth :)

I would like to add a fix date to the calculation but it seems it not like my date format (dd-mm-yyyy)

Can someone help me?

wish and thx

It should work with any date format. Could you send me the fwz file for the form?

Thanks. I tried with hidden field, text

I will send you in two days.

Target required!


I downloaded it today, what I see Looks very easy,

I don't how it go with my Complex Projects which I have in Mind.


I used to have an aspx-form with a free headache every new version of Windows or Visual Studio. When I had enough of it, I searched for another solution and stumbled upon this website and I must say: this is some great tool. We only use a small percentage of what can be done with this form-generator. The fun part is you just follow a simple wizard, fill in your webhosting-information, do all the fun parts, while the difficult and technical parts are done by the program. I'm using Simfatic Forms since july 2010 and I'm glad I decided to change. Cheers!

May I say, what an excellent tool this piece of software is! It's saved me probably weeks of work.

Well Done!

Thanks Mike!