Date Validation

Using Client Validation, we will show you how to verify a user is selecting a date in the future and not the past.

STEP 1: Add two Date widgets to your form. For this example, the Data Column Names are date1 and date2.

STEP 2: In the date1 element, place this code in the Dynamic Value (A): date1=new Date(). This will dynamically populate this element with the current date. In the Condition Value (B) put: false. By making the Conditional Value false, the user will not see this element on their device.

STEP 3: In the date2 element, place this code in Client Validation (A): Number(date2)>Number(date1). This code will check to make sure that date2's date is greater than date1's. In the Validation Message (B) put: "Please enter a future date." Be sure to include the quotation marks around the message or it will fail to appear.

Using the above form layout and JavaScript coding, the user will see the following on his or her device:

When the user enters a date which is not in the future, they will receive this message: