Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

551
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda