lundi 12 juillet 2021

Submit form only if a checkbox is checked

I'm trying to submit a form with javascript, I need that when verifying a checkbox send the form automatically, in a few seconds.

<form  method="POST" action="">
    
    @csrf
    <div class="row">
        <div class="col">
            Confirmar Asistencia: 
        </div>
        <div class="col">
            <label class="switch s-icons s-outline s-outline-success mr-2">
                <input name="cconfirma" type="checkbox">
                <span class="slider round"></span>
            </label>
        </div>
    </div>
    <br>
    <div class="row">
        <div class="col">
            Cancelar Turno: 
        </div>
        <div class="col">
            <label class="switch s-icons s-outline s-outline-danger mr-2">
                <input name="ccancela" type="checkbox">
                <span class="slider round"></span>
            </label>
        </div>
    </div>
</form>

If someone verifies a checkbox, the form is submitted automatically.




Aucun commentaire:

Enregistrer un commentaire