Commit dc5ba19e authored by grisel-davy's avatar grisel-davy

Ajout du champ requiered si le disclaimer est affiché

parent ff577093
......@@ -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>
......@@ -95,14 +94,34 @@ function submitBday() {
{% render_field userform.disclaimer class="form-control" %}
</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 }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment