[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/javascript/ -> advanced_search.js.php (source)

   1  <script language="javascript" src="includes/javascript/general.js" type="text/javascript"></script>
   2  <script language="javascript" type="text/javascript"><!--
   3  function check_form() {
   4    var error_message = "<?php echo JS_ERROR; ?>";
   5    var error_found = false;
   6    var error_field;
   7    var keywords = document.advanced_search.keywords.value;
   8    var dfrom = document.advanced_search.dfrom.value;
   9    var dto = document.advanced_search.dto.value;
  10    var pfrom = document.advanced_search.pfrom.value;
  11    var pto = document.advanced_search.pto.value;
  12    var pfrom_float;
  13    var pto_float;
  14  
  15    if ( ((keywords == '') || (keywords.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)) ) {
  16      error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
  17      error_field = document.advanced_search.keywords;
  18      error_found = true;
  19    }
  20  
  21    if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>')) {
  22      if (!IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) {
  23        error_message = error_message + "* <?php echo ERROR_INVALID_FROM_DATE; ?>\n";
  24        error_field = document.advanced_search.dfrom;
  25        error_found = true;
  26      }
  27    }
  28  
  29    if ((dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>')) {
  30      if (!IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>')) {
  31        error_message = error_message + "* <?php echo ERROR_INVALID_TO_DATE; ?>\n";
  32        error_field = document.advanced_search.dto;
  33        error_found = true;
  34      }
  35    }
  36  
  37    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; ?>'))) {
  38      if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) {
  39        error_message = error_message + "* <?php echo ERROR_TO_DATE_LESS_THAN_FROM_DATE; ?>\n";
  40        error_field = document.advanced_search.dto;
  41        error_found = true;
  42      }
  43    }
  44  
  45    if (pfrom.length > 0) {
  46      pfrom_float = parseFloat(pfrom);
  47      if (isNaN(pfrom_float)) {
  48        error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
  49        error_field = document.advanced_search.pfrom;
  50        error_found = true;
  51      }
  52    } else {
  53      pfrom_float = 0;
  54    }
  55  
  56    if (pto.length > 0) {
  57      pto_float = parseFloat(pto);
  58      if (isNaN(pto_float)) {
  59        error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
  60        error_field = document.advanced_search.pto;
  61        error_found = true;
  62      }
  63    } else {
  64      pto_float = 0;
  65    }
  66  
  67    if ( (pfrom.length > 0) && (pto.length > 0) ) {
  68      if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
  69        error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
  70        error_field = document.advanced_search.pto;
  71        error_found = true;
  72      }
  73    }
  74  
  75    if (error_found == true) {
  76      alert(error_message);
  77      error_field.focus();
  78      return false;
  79    } else {
  80      RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
  81      RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
  82      return true;
  83    }
  84  }
  85  
  86  function popupWindow(url) {
  87    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
  88  }
  89  //--></script>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7