ccc

JS: Check campo FILE no contenga eñes ni tildes

function checkTildes(nomFoto) {
retorno = true;
if (nomFoto.indexOf("á") != -1) {
retorno = false;
}
if (nomFoto.indexOf("é") != -1) {
retorno = false;
}
if (nomFoto.indexOf("í") != -1) {
retorno = false;
}
if (nomFoto.indexOf("ó") != -1) {
retorno = false;
}
if (nomFoto.indexOf("ú") != -1) {
retorno = false;
}
if (nomFoto.indexOf("ñ") != -1) {
retorno = false;
}
return retorno;
 }

 $("document").ready(function(){
$("#fotoGrande").change(function() {
foto = document.getElementById("fotoGrande");
        if (!checkTildes(foto.value)) {
alert("Error: La foto de Foto grande contiene tildes o eñes: "+foto.value);
}
    });
});

Foto grande: <input type="file" id="fotoGrande" name="fotoGrande">

No hay comentarios:

Publicar un comentario