I have a form with two selects and both are "required". I want the submit to be done when changing the second one, but I have set it onchange="submit ()" and it does not work, it does submit although no option has been selected in the first one. Does anyone have a solution?
<form id="formulario" action="Servlet" method="post">
<select name="idsociedad" id="idsociedad" required>
<option value="">Seleccione una opción</option>
<option value="opcion1">Opción 1</option>
<option value="opcion2">Opción 2</option>
<option value="opcion3">Opción 3</option>
</select>
<select name="ano" id="ano" onchange="submit()" required>
<option value="">Seleccione el año</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
</select>
</form>