I have a little problem with this code :
<form class="form-horizontal" method="post" action="{{ route('bilan.resultat.add', ['bilanId' => $bilan->id] )}}" id="form" name="formu">
{{ csrf_field() }}
<table class="table table-striped">
<thead>
<tr>
<th>Sexe</th>
<th>Age</th>
<th>Taille</th>
<th>Poids</th>
</tr>
</thead>
<tbody class="text-primary">
<tr>
<td><input id="age" size="7" maxlenght="3" name="valage" value="{{ $bilan->age }}" readonly></td>
<td><input size="7" maxlenght="3" name="valtaille" value="{{ $bilan->Taille_cm }}" readonly></td>
<td><input type="hidden" size="2" maxlenght="3" id="anc_id" name="anc_id" value="{{ $bilan->resultat->anc_id }}" readonly></td>
<td><a href="/bilans" class="btn btn-outline-primary pull-right" role="button">Retour</a></td>
</tr>
</tbody>
</table>
<table class="table table-responsive">
<tr>
<td><p class="text-primary">Indice de masse corporelle (IMC)</p></td>
<td><input name="imc" size="5" value="@if($bilan->resultat !== null) {{ $bilan->resultat->imc }} @endif"/></td>
<td><p hidden class="text-primary">Fréquence cardiaque maximale</p></td>
<td><input type="hidden" name="fcm" size="5" value="@if($bilan->resultat !== null) {{ $bilan->resultat->fcm }} @endif"/><a hidden> b/min</a></td>
</tr>
<tr>
<td><p class="text-primary">Distance minimale normale</p></td>
<td><input name="dmn" size="5" value="@if($bilan->resultat !== null) {{ $bilan->resultat->dmn }} @endif"/><a> m</a></td>
<td><p hidden class="text-primary">Fréquence cardiaque de travail 50%</p></td>
<td><input type="hidden" name="fct50" size="5" value="@if($bilan->resultat !== null) {{ $bilan->resultat->fct50 }} @endif"/><a hidden> b/min</a></td>
</tr>
</table>
<a href="/bilans" class="btn btn-outline-primary pull-right" role="button">Retour</a>
</form>
I want to auto load the form when the page is loaded so i add the script :
<script>
window.onload = function() { ancrecupid(); calculerIMC(); calculerDMN(); document.getElementById('form').submit(); };
</script>
It works but the page is reloaded every second, and i just want the form to be loaded once...
I have several functions to load that's why i put function() { ancrecupid(); calculerIMC();....
What's wrong in my code ?