function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Complete noviceComplete novice 

Web to case validation rule

Hi, I am completely new to coding and am trying to set up a validation rule on a web to case form.  I have date fields (option 1 date 1, option 1 date 2, option 2 date 1, option 2 date 2) and I want a validation rule that will prevent Date 2 being earlier than Date 1.

I have found some example code online and have tried it on my web form but it hasn't worked.

This is what I have tried:

User-added image

It still allows any date to be added and the case is created in Salesforce.

Can anyone explain in really simple terms what I have done wrong or what I could try please?

Many thanks.
Ramesh DRamesh D
If you are doing in javaScript try using Date.parse something like this 
Date.parse(endDate) <= Date.parse(startDate)

Thanks
Ramesh​​​​​​​