0
//Part of the form to which I want to apply the loop
<div class="form-row">
<div class="form-group col-md-6">
<label>Curso</label>
<input name="cursolivre" id="cursolivre" class="form-control" type="text" value="">
</div>
<div class="form-group col-md-6">
<label>Segmento</label>
<select class="form-control" name="segmento" id="segmento">
<option value="Administrativo">Administrivo</option>
<option value = "Tecnologico">Tecnológico</option>
<option value="Tecnico">Técnico</option>
<option Value="Livre">Livre</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Inicio</label>
<input name="iniciol" id="iniciol" class="form-control" type="date" value="">
</div>
<div class="form-group col-md-3">
<label>Termino</label>
<input name="termino" id="termino" class="form-control" type="date" value="">
</div>
<div class="form-group col-md-2">
<label>Carga Horário</label>
<input name="cargahorario" id="cargahorario" class="form-control" type="number" value="">
</div>
</div>
<button class="btn btn-default btn-adicionar-curso-livre" onclick="inserirTabela()" type="button"><span></span><img src="{{ asset('imagens/plus.png')}}" width="20px" alt=""> <strong>Nova Atividade</strong></button>
<div class="form-row">
<div class="form-group col-md-12">
<table class="table table-striped">
<thead class="table-light">
<tr>
<th scope="col">Curso</th>
<th scope="col">Segmento</th>
<th scope="col">Inicio</th>
<th scope="col">Termino</th>
<th scope="col">Carga Horário</th>
</tr>
</thead>
<tbody>
<tr>
<th id="dado1"></th>
<th id="dado2"></th>
<th id="dado3"></th>
<th id="dado4"></th>
<th id="dado5"></th>
</tr>
</tbody>
</table>
</div>
//Insertion code
function inserirTabela(){
var curso = document.form1.cursolivre.value;
var segmento = document.form1.segmento.value;
var inicio = document.form1.iniciol.value;
var termino = document.form1.termino.value;
var cargahorario = document.form1.cargahorario.value;
document.getElementById("dado1").innerHTML = curso;
document.getElementById("dado2").innerHTML = segmento;
document.getElementById("dado3").innerHTML = inicio;
document.getElementById("dado4").innerHTML = termino;
document.getElementById("dado5").innerHTML = cargahorario;
}
When I click on new activity, I need to insert it in a new line below the first activity, save in an array to send to my bank.
Ideally you would create a Javascript object, and each post you would include that object of a new record in an array. In the procedure of saving in the database. Then you would have several approaches, you can send the array to the server, so that the server persists, or create a function that goes through the array, going to the server for each record. If you want any of these approaches, I can create an answer with Js code for you.
– Rodrigo K.B
I accept yes, I need a north!
– Allan Conde