8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-24 07:53:47 +00:00

Ajout du champ requiered si le disclaimer est affiché

This commit is contained in:
grisel-davy 2018-08-24 11:33:00 +02:00
parent ff57709337
commit dc5ba19e59

View file

@ -37,7 +37,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" type="text/css">
<script type='text/javascript'>
function submitBday() {
var field = document.getElementById("file");
var Bdate = document.getElementById('bday').value;
@ -66,26 +65,26 @@ function submitBday() {
</div>
<div class="form-group col-md-4">
{{ userform.surname.label_tag }}
{% render_field userform.surname class="form-control" %}
{% render_field userform.surname class="form-control" requiered=True %}
</div>
<div class="form-group col-md-4">
{{ userform.pseudo.label_tag }}
{% render_field userform.pseudo class="form-control" %}
{% render_field userform.pseudo class="form-control" requiered=True %}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
{{ userform.email.label_tag }}
{% render_field userform.email class="form-control" %}
{% render_field userform.email class="form-control" requiered=True %}
</div>
<div class="form-group col-md-4">
{{ userform.telephone.label_tag }}
{% render_field userform.telephone class="form-control" %}
{% render_field userform.telephone class="form-control" requiered=True %}
</div>
<div class="form-group col-md-4">
<label>Date de naissance</label>
<input class="form-control" id="bday" name="bday" date-date-format="dd-mm-yy" placeholder="Date de naissance" type="date" onchange="submitBday()">
<input class="form-control" id="bday" name="bday" date-date-format="dd-mm-yy" requiered=True placeholder="Date de naissance" type="date" onchange="submitBday()">
</div>
</div>
@ -96,13 +95,33 @@ function submitBday() {
</div>
</div>
<script type='text/javascript'>
function submitBday() {
var field = document.getElementById("file");
var Bdate = document.getElementById('bday').value;
var Bday = +new Date(Bdate);
var age = ((Date.now() - Bday) / (31557600000));
if (age < 18){
field.style.display = "block";
document.getElementById("{{userform.disclaimer.auto_id}}").required = true;
}
else{
field.style.display = "none";
document.getElementById("{{userform.disclaimer.auto_id}}").required = false;
}
}
</script>
<div class="form-group">
{{ userform.school.label_tag }}
{% render_field userform.school class="form-control" %}
{% render_field userform.school class="form-control" requiered=True %}
</div>
<div class="form-group">
{{ userform.room.label_tag }}
{% render_field userform.room class="form-control" %}
{% render_field userform.room class="form-control" requiered=True %}
</div>
<div class="form-group">
{{ userform.comment.label_tag }}