Skip to content

Commit

Permalink
birthday validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingirorhaun committed Apr 22, 2024
1 parent e38092c commit ba38565
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function validate(e) {

//first name validation
let firstName = formData[0].getElementsByTagName("input")[0].value;
console.log(firstName);
if (firstName === "") {
showValidationError(formData[0], "Le prénom est requis");
} else if (firstName.length < 2) {
Expand Down Expand Up @@ -72,6 +71,16 @@ function validate(e) {
hideValidationError(formData[2]);
}

// birthday validation
let birthday = formData[3].getElementsByTagName("input")[0].value;
console.log(birthday);
if (birthday === "") {
showValidationError(formData[3], "Veuillez sélectionner une date");
} else {
// a date is selected
hideValidationError(formData[3]);
}

// nb of tournaments validation
let nbOfTournaments = formData[4].getElementsByTagName("input")[0].value;
if (nbOfTournaments === "") {
Expand Down

0 comments on commit ba38565

Please sign in to comment.