Commit a5f4debf authored by Maxime's avatar Maxime
Browse files

bugfix: script that validates URL formats

parent 5bef1c91
......@@ -674,20 +674,27 @@ Le : <span id="currentDate"></span>
default:
}
// check if any email fields & if format ok
//display errors
showErrors(currenErrors,errorDiv,formId);
/***********
check email format
***********/
function CheckUrlFormat(tagName,errorMessage){
tagName = this.tagName;
errorMessage = this.errorMessage;
urlField = form.querySelectorAll(tagName);
console.log(urlField);
currenErrors.push("Veuillez commencer votre URL avec \"http://\" ou \"https://\" adresse email contient une erreur");
event.preventDefault();
}
/*================================
Functions bellow
&& !emailPlaceholder.includes(electedText)
================================*/
/***********
check email format
***********/
......@@ -697,19 +704,17 @@ Le : <span id="currentDate"></span>
allFields = form.querySelectorAll("input");
for (i = 0; i < allFields.length; i++) {
emailPlaceholder = (allFields[i].placeholder).toLowerCase();
emailText = "email";
electedText = "élu";
let emailPlaceholder = (allFields[i].placeholder).toLowerCase();
let emailText = "email";
let electedText = "élu";
emailValue = allFields[i].value;
if (emailPlaceholder.includes(emailText)) {
//if elected official field, pass by
if (emailPlaceholder.includes(electedText)) {
console.log("elected field");
}
//if elected official field, pass by
//if email feild && not empty, check value
else if (emailRegEx.test(emailValue) == false && emailValue.length != 0 && !(emailPlaceholder.includes(electedText)) ) {
currenErrors.push("Le format de votre adresse email contient une erreur");
......
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