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

552
Vistas
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
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