-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscriptJsCreateCompetition.html
More file actions
33 lines (33 loc) · 1.34 KB
/
scriptJsCreateCompetition.html
File metadata and controls
33 lines (33 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<script>
function validateFields(input){
if (input.name.value.length === 0){
const divName = document.getElementById('div-name');
const div = document.createElement('div');
div.className = "warning";
div.innerHTML = "Veuillez entrer le nom de la compétition.";
divName.appendChild(div);
setTimeout(()=>{
div.parentNode.removeChild(div);
}, 2000);
}else if (input.town.value.length === 0){
const divTown = document.getElementById('div-town');
const div = document.createElement('div');
div.className = "warning";
div.innerHTML = "Veuillez entrer la ville qui accueille la compétition.";
divTown.appendChild(div);
setTimeout(()=>{
div.parentNode.removeChild(div);
}, 2000);
}else if (input.year.value.length === 0 || isNaN(parseInt(input.year.value))){
const divYear = document.getElementById('div-year');
const div = document.createElement('div');
div.className = "warning";
div.innerHTML = "Veuillez un nombre correcte.";
divYear.appendChild(div);
setTimeout(()=>{
div.parentNode.removeChild(div);
}, 2000);
}else
google.script.run.addCompet(input);
}
</script>