Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!