- emedpedsAsked on April 24, 2015 at 07:00 PM
is there a widget for start and end dates that prevents choosing an end date earlier then the start date? Trying to prevent a time or date period error
- CharlieAnswered on April 25, 2015 at 04:25 AM
So basically, when you add an end date earlier than the start date it will show you an error message and hides the submit button. Here's how I setup mine:
1. These are the things that I added in my form:
a) a "Text" field under Form Tools section that will act as the error message.
b) Two default date fields that we will be comparing.
c) Add a form calculation widget and name it "Date Difference", this is where we will calculate between Start Date and End Date.
d) The "Conditions" option to where we will compare the result in the "Date Difference".
2. In my Form calculation widget, this is my formula:
End Date - Start Date = the difference between them.
You can use the "Add Fields" button to add the fields and perform a calculation.
3. After that, go to your "Conditions" and setup a condition. I'll choose the first option which is to "Show / Hide a form field".
4. This is how I setup my rules and what actions to take place.
So basically, if the date difference is less than "0", which means a negative value, it will show the error message and hide the submit button. When you get a negative value in the date difference, it means that the end date is earlier than the start date.
Do let us know if you need more help on this.