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

548
Views
How to create standard error messages like HTML's using Javascript?

So I have a form with steps 1, 2, 3 and so on, where there is only 1 form submit to the server at the end of step 3 (what I mean by step for example like this).

For example, the form code looks like this:

HTML

<div class="form-group">
        <label for="jepen_editpro1" class="control-label">Jenjang Pendidikan <span class="required">*</span></label>
        <select id="jepen_editpro1" name="jepen_editpro[]"
            class="select form-control cst-profile" required="required">
            <option disabled selected value> -- Pilih jenjang -- </option>
            @foreach ($list_edustage as $dataEdustage)
            <option value="{{ $dataEdustage->id_jenjang }}" data-jenjang1="{{ $dataEdustage->id_jenjang }}">{{$dataEdustage->nama_jenjang }}</option>
            @endforeach
        </select>
</div>

And for example validation using Javascript I use like this:

JS

var jepen_editpro1 = document.getElementById('jepen_editpro1');
if (!jepen_editpro1.checkValidity()) {
alert(jepen_editpro1.validationMessage);
} else {
alert("Enter OK");
}

The JS validation is running well, displaying an error message according to the attribute I specified in the HTML above, where it is required.
But my question is, how do I make a warning box similar to the standard HTML as shown below, along with the auto focus function and the error message? enter image description here

I've done research here and there but can't find a way.. Do I have to make a manual for the focus function and the message box? Thank you for your help

about 4 years ago · Juan Pablo Isaza
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!