<form>
<input type="date" id="date1" />
<input type="time" id="time1" />
<input type="date" id="date2" />
<input type="time" id="time2" />
</form>
I have two date elements and two time elements on my form. I want to be able to have date1
required if time1
is not empty, and the same for date2
and time2
. I also want to have date2 >= date1
if date1
is not empty, and similarly date1 <= date2
if date2
is not empty.
Using the data-dependent-validation
jsfiddle sample at http://afarkas.github.io/webshim/demos/demos/forms.html#Custom-validity I can see how to do both of those validation rules, but I can't see how to apply both at the same time. Is this possible?