Skip to main content
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:

Web to case validation rule

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.
1 answer
  1. Apr 12, 2019, 9:26 AM

    If you are doing in javaScript try using Date.parse something like this 

    Date.parse(endDate) <= Date.parse(startDate)

    Thanks

    Ramesh​​​​​​​
0/9000