You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This is a quick script on how to can compare 2 dates and ensures that one is larger than the other. Please put this script in a Custom HTML element in your form. Remember to enclose this coding in the <script type="text/javascript"> block.

$('form').submit(function(){
	startDate = $("input[name='start_date']").val();
	endDate = $("input[name='end_date']").val();
	if( endDate < startDate ){
		alert("End Date must be larger than the Start Date. Please try again.");
		return false;
	}else{
		return true;
	}
});
  • No labels