Hello, I have the following problem. I want to compare 1 string with the value of some input as allowed values, but honestly, I cannot make the comparison take place.
I get the values of a form is the following way
function obtenerdatosfrm(idfr){ //función que obtiene datos del formulario X
const form = document.getElementById(idfr);
const formData = new FormData(form);
return formData;
}
later in my html I have a button that calls functionagregar_nuevo_proveedor()
<button type="button" class="btn btn-success" id="agregarnuevo" data-bs-dismiss="modal" onclick="agregar_nuevo_proveedor('form_para_agregar_nuevo_proveedor')">Agregar</button>
the add_new_vendor function:
function agregar_nuevo_proveedor(idform){
vacios= validarfrmvacio(idform);
if(vacios>0){
Swal.fire('Tienes campos vacíos')
}else{
let datosdelfrm= obtenerdatosfrm(idform);
for (const valor of datosdelfrm.entries()) {
permitidos= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@-_.';
for ($i=0; $i< valor[1].length; $i++){
if(){//comparáramos si en valor[1] tiene un tiene algún dato no permitido de la variable permitidos.
}
}
}
}