I have a CF page, main.cfm, for searching records based a various input fields. The search form's action page points back to itself (main.cfm).
<form id="frm_srch" action="main.cfm" method="post" onSubmit="return validate_search_form()">
   <input id="order_date" name="OrderDate_srch" type="text"/>
I wired up the JS function validate_search_form() to onSubmit, and everything works ok except for the actual aborting of the page load.
function validate_search_form() {               
  var order_date = $("input[name='OrderDate_srch']").val();     
  var d = new Date(order_date);
  if( d == 'Invalid Date' && order_date != "" ) {
    alert("Invalid order date");
    returnToPreviousPage();
    //window.history.back();
    //event.returnValue = false;
    return(false);
  }
  alert("validations passed");
  //event.returnValue = true;
  return(true);     
}
I also tried creating an event handler to simply always prevent the page load, like so
$('#frm_srch').submit(function (evt) {
  evt.preventDefault();
  window.history.back();
});
and everything else suggested in this post javascript to stop form submission
Is there anyway to make this happen from a CF page using a regular form? Using cfform/cfinput doesn't work in my case b/c I cannot get the date field to toggle as disabled/enabled correctly (it's associated to a checkbox, and this behavior is for another post)? Thanks.
 
     
    