function check_form() { var error_message = "Erori::\n"; var error_found = false; var error_field; var keywords = document.advanced_search.keywords.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 ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == 'DOB_FORMAT_STRING') || (dfrom.length < 1)) && ((dto == '') || (dto == 'DOB_FORMAT_STRING') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) { error_message = error_message + " Cel putin un camp din formularul de cautare trebuie accesat.\n"; error_field = document.advanced_search.keywords; error_found = true; } if ((dfrom.length > 0) && (dfrom != 'DOB_FORMAT_STRING')) { if (!IsValidDate(dfrom, 'DOB_FORMAT_STRING')) { error_message = error_message + "\t- Invalid de la Data.\n"; error_field = document.advanced_search.dfrom; error_found = true; } } if ((dto.length > 0) && (dto != 'DOB_FORMAT_STRING')) { if (!IsValidDate(dto, 'DOB_FORMAT_STRING')) { error_message = error_message + "\t- Invalid la Data.\n"; error_field = document.advanced_search.dto; error_found = true; } } if ((dfrom.length > 0) && (dfrom != 'DOB_FORMAT_STRING') && (IsValidDate(dfrom, 'DOB_FORMAT_STRING')) && (dto.length > 0) && (dto != 'DOB_FORMAT_STRING') && (IsValidDate(dto, 'DOB_FORMAT_STRING'))) { if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) { error_message = error_message + "\t- La Data trebuie sa fie mai mare sau egal cu De La Data. \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 + "\t- Pretul De La trebuie sa fie un numar. \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 + "\t- Pretul La trebuie sa fie un numar.\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 + "\t- Pretul La trebuie sa fie mai mare sau egal cu Pretul De La.\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, "DOB_FORMAT_STRING"); RemoveFormatString(document.advanced_search.dto, "DOB_FORMAT_STRING"); return true; } }