Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validating email addresses in Google Forms

I want to use a Google Form to populate a Google Spreadsheet. One of the fields is email address, and I need to validate this against the list of emails for our organisation - in other words forcing people to use valid and existing email addresses.

Our organisation uses Google Apps. The form will be created by a user who is in our organisation and only email addresses from our organisation/domain will be considered valid.

like image 302
andyg1 Avatar asked May 18 '12 09:05

andyg1


People also ask

How do you validate an email in a form?

The best way to "validate" an email addresses is to simply have them type it twice and run a Regex check that gives a WARNING to the user that it doesn't look like a valid email address if it does not match the pattern, and asks the user to double check.

Can Google Forms generate a confirmation email?

With Email Notifications, you can automatically send a confirmation email to respondents after they submit your Google Form. You can create a pre-written auto-responder template and the form submitter will get your confirmation email almost instantly.

How do I validate names in Google Forms?

Just click the triple dot on the lower right of the field. Then choose Regular expression and Matches on the following drop downs. Use the regular expression below to accept valid names generally, and input an error message if the regular expression is not followed.

Can we add validation in Google Forms?

You can add response validation to restrict the answers that users can enter for a question. To add a response validation, select a question in Google Forms, click on ⋮ More icon and select show Response validation. The response validations that you can add varies by question type.


2 Answers

Now you can put a Regular Expresion in the field:

For EMAIL:

[a-zA-Z0-9_\.\+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+
like image 117
Romias Avatar answered Sep 19 '22 18:09

Romias


You can use the experimental Apps Script Domain Services API. Here's how I'd do it.

function isValidEmailInMyDomain(address) {
  var parts = address.split('@');
  if( parts.length != 2 )
    return false;
  if( parts[1] != UserManager.getDomain() )
    return false;
  try {
    UserManager.getUser(parts[0]);
    return true;
  } catch(doesNotExist) {
    return false;
  }
}

function testFunction() { //check the menu View > Logs
  Logger.log(isValidEmailInMyDomain('[email protected]'));
}
like image 43
Henrique G. Abreu Avatar answered Sep 18 '22 18:09

Henrique G. Abreu