Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Validate email js: Difference between revisions

From Catglobe Wiki
No edit summary
No edit summary
Line 5: Line 5:
Question.bind('afterValidateQuestion', function(ev, question, state) {
Question.bind('afterValidateQuestion', function(ev, question, state) {
   var invalidemail="Emailadressen er ikke korrekt. Ret venligst emailadressen";
   var invalidemail="Emailadressen er ikke korrekt. Ret venligst emailadressen";
   var email = question.subQuestions[1].attr('answer');
   var email = question.attr('answer');
   if (!validateEmail(email))
   if (!validateEmail(email))
      {
      {

Revision as of 08:16, 5 June 2018

This solution will help you validate email

Here is a way that we can use to make this solution easily:

Question.bind('afterValidateQuestion', function(ev, question, state) {
   var invalidemail="Emailadressen er ikke korrekt. Ret venligst emailadressen";
   var email = question.attr('answer');
   if (!validateEmail(email))
      {
        question.attr('errorMessage', invalidemail);
        state.valid = false;
      }
});
window.validateEmail = function(emailAddress) {
  var pattern = new RegExp(/^([a-zA-Z0-9-_.]{1,128})@(\w+([-.]\w+)*\.\w+([-.]\w+)*)$/i);  
  return pattern.test(emailAddress);
};