jarry, thanks again for your intervention.
unfortunately the code you provided doesn't work.
I don't know where the problem is, I've put the code online just to let you check it.
please try the following url:
https://neron.telegram.press/test_1.phpthe idea is to check the process: if the date fields are empty you will see the red color in the fields.
if the second date is before the first date, the red color doesn't show (the event is not fired).
the complete code of the test_1.php is as follows:
#################
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/demo.css">
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<center>
<form method="post" name="mainForm" id="mainForm" accept-charset="UTF-8">
<div style="margin:20px 0;"></div>
<div class="easyui-panel" style="width:100%;max-width:800px;padding:30px 60px;">
<table width="100%" border="0">
<tr>
<td valign="middle" align="center">
<div style="margin-bottom:20px">
<input class="easyui-datebox" label="dateFrom:" labelPosition="top" style="width:200px;" id="evalFrom" name="evalFrom" required data-options="formatter:myformatter,parser:myparser,editable:false,required:true">
</div>
</td>
</tr>
<tr>
<td valign="middle" align="center">
<div style="margin-bottom:20px">
<input class="easyui-datebox" label="dateTo:" labelPosition="top" style="width:200px;" id="evalTo" name="evalTo" data-options="formatter:myformatter,parser:myparser,editable:false,required:true,validType:'greaterThan[\'#evalFrom\']'">
</div>
</td>
</tr>
</table>
</div>
<br />
<table width="100%" border="0">
<tr>
<td width="60%"> </td>
<td width="40%"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">Submit</a></td>
</tr>
</table>
</form>
</center>
<script>
function myformatter(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
if (!s) return new Date();
var ss = (s.split('-'));
var y = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var d = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
}
function submitForm(){
$('#mainForm').attr('action', 'test_2.php');
$('#mainForm').form('submit');
}
</script>