Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
how to make a alert to the user when the data entered is not appropriate?

how to make a warning to the user when the data entered is not appropriate? when a user is entering his data, an alert will appear when entering data that is not appropriate. For example, in the input field, the username must only use the alphabet and numbers and may not use symbols. If the user enters a symbol, an alert will appear. example :

function validation() {
    let nameregex = /^[a-zA-Z]+$/;
    let emailregex = /^[a-zA-Z0-9]+@(gmail|yahoo|outlook)\.com$/;
    let userregex = /^[a-zA-Z0-9]{5,};
    if (!nameregex.test(name.value)) {
        alert("Nama harus menggunakan alfabet");
        return false;
    }
    if (!emailregex.test(email.value)) {
        alert("Masukan email yang valid");
        return false;
    }
    if (!user.test(username.value)) {
        alert("username bisa menggunakan alphabet\n-username menggunakan 5 karakter\n ");
        return false;
    }
    return true;
}
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Here is a minimalist example of how you can do it. In this case there is no JavaScript required:

<form>
<input type="text" name="name" required pattern="[a-zA-Z]+" title="letters only, at least one character" placeholder="Name"><br>
<input type="text" name="name" required pattern="^[a-zA-Z][a-zA-Z._]*@(gmail|yahoo|outlook)\.com$" title="Only email accounts from Gmail, Yahoo or Microsoft are admissible." placeholder="email"><br>
<input type="text" name="uname" required pattern="[a-zA-Z0-9]{5,}" title="Letters and numbers only, at least five characters are required." placeholder="username">
<button>OK</button>
</form>

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda