HeikkiS

Validating email address

Discussion created by HeikkiS on Nov 30, 2017
Latest reply on Dec 4, 2017 by HeikkiS

Hi

 

I want to validate email address (or UPN) in my form.  I did some “google research” and found a script that should do the thing (https://www.w3resource.com/javascript/form/email-validation.php#).

 

function ValidateEmail(extAccountName) 

  var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

  if(extAccountName.value.match(mailformat)) 

  { 

    return true; 

  } 

  else 

  { 

    return false; 

  } 

}

 

Field name in form is extAccountName, which is created by concatenating a few fields together

 

"ext-" + [[extUserFirstName]] + "." + [[extUserName]] + "@almamedia.fi"

 

Calculating the value by first and last name works, but validation doesn’t. It rejects then input in every case. How should I do the validation?

Outcomes