I need help with basic logic ... I have a form with 4 fields that when I click the% button on the button, I need to validate if at least one of the search fields has been filled out. I only managed to validate the first field, but when I leave the first blank and fill in the second, it says that no field has been filled ... Could someone help me?
function valida_form() {
if ((document.getElementById("numeroPedido").value == null || document.getElementById("numeroPedido").value == "") && (document.getElementById("codigoCliente").value == null || document.getElementById("codigoCliente").value == "") && (document.getElementById("dataInicial").value == "" || document.getElementById("dataInicial").value == null) && (document.getElementById("dataFinal").value == "" || document.getElementById("dataFinal").value == null)) {
alert('Informe um filtro de pesquisa.');
return false
} else {
return true
}
}