Hello, I am doing a validation of the value of an input type text, and I want to validate it if it exists in a csv file, if it exists that performs certain actions, I was doing it with switch case, but they are more than 200 numbers of series.
<label>Número de Serie del Producto <button onclick="myValidation()">VALIDAR NÚMERO DE SERIE</button><span id="mensaje"></span><br>
<span><input type="number" name="numero_serie" id="mySerie" value="" size="40" maxlength="9" aria-required="true" aria-invalid="false" placeholder="Escribe Aquí"></span></label>
<script>
function myValidation() {
var text;
var series = document.getElementById("mySerie").value;
switch(series) {
case "959189132":
case "2572331":
case "44265108":
text = "Validado";
document.getElementById("register").disabled = false;
break;
default:
text = "Número no valido";
document.getElementById("mySerie").value = "";
document.getElementById("register").disabled = true;
}
document.getElementById("mensaje").innerHTML = text;
}
</script>
Or if there is another method to validate, capable with mysql and php database, I would appreciate your input. Thanks