Well it's been a while since I've looked at these functions, but when I look at it now I'm a little puzzled myself.. I know that it used to work on my old setup, but when I try it from the start now, I see that there's some javascript kicking in, complaining about non-valid date formats. Maybe there was something I forgot I had done when posting this earlier.
What you need to do, is either remove the javascript check, or make up a new javascript date validator function or tweak the old one somewhat. Guess which one is easier.
I'm not a big fan of javascript, so my best bet is that I removed the javascript code, as it's totally unnecessary, and IMO just cluttering up the code.
Sure, it can save you the time it takes to reload the page, but it also adds to the size of the page. IMO it's rarely worth it.
Here's how to remove the javascript that validates the form before submitting:
Edit includes/templates/<your template>/templates/tpl_advanced_search_default.php:
Replace line 23:
<?php echo zen_draw_form('advanced_search', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onsubmit="return check_form(this);"') . zen_hide_session_id(); ?>
with the following
<?php echo zen_draw_form('advanced_search', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . zen_hide_session_id(); ?>
That's basically it, but you can also remove the now unused javascript code for that page, from includes/modules/pages/advanced_search/jscript_main.php:
function check_form() {
var error_message = "<?php echo JS_ERROR; ?>";
var error_found = false;
var error_field;
var keyword = document.advanced_search.keyword.value;
var dfrom = document.advanced_search.dfrom.value;
var dto = document.advanced_search.dto.value;
var pfrom = document.advanced_search.pfrom.value;
var pto = document.advanced_search.pto.value;
var pfrom_float;
var pto_float;
if ( ((keyword == '') || (keyword.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
error_field = document.advanced_search.keyword;
error_found = true;
}
if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>')) {
if (!IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) {
error_message = error_message + "* <?php echo ERROR_INVALID_FROM_DATE; ?>\n";
error_field = document.advanced_search.dfrom;
error_found = true;
}
}
if ((dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>')) {
if (!IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>')) {
error_message = error_message + "* <?php echo ERROR_INVALID_TO_DATE; ?>\n";
error_field = document.advanced_search.dto;
error_found = true;
}
}
if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) && (dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>'))) {
if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) {
error_message = error_message + "* <?php echo ERROR_TO_DATE_LESS_THAN_FROM_DATE; ?>\n";
error_field = document.advanced_search.dto;
error_found = true;
}
}
if (pfrom.length > 0) {
pfrom_float = parseFloat(pfrom);
if (isNaN(pfrom_float)) {
error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
error_field = document.advanced_search.pfrom;
error_found = true;
}
} else {
pfrom_float = 0;
}
if (pto.length > 0) {
pto_float = parseFloat(pto);
if (isNaN(pto_float)) {
error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
error_field = document.advanced_search.pto;
error_found = true;
}
} else {
pto_float = 0;
}
if ( (pfrom.length > 0) && (pto.length > 0) ) {
if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
error_field = document.advanced_search.pto;
error_found = true;
}
}
if (error_found == true) {
alert(error_message);
error_field.focus();
return false;
} else {
RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
return true;
}
}
The entire above function can be removed.
This will remove the client-side date validation. Keep in mind that the validation is still done server-side, with php.