Data validation tools in Google Forms – explained


How to implement captcha in Google Form? How to validate data entered in Google Forms? How to make sure that Google Form will be filled out with answers according to the given directions? These are the most asked questions when it comes to design and implementation of any questionnaire, including the Google Forms.

Depending on the type of the question, there are several types of validation tools available as part of the Google’s form designer.

If the question type is “Text” then you have Number, Text or Regular Expression as validation tools (only one at a time).

When the question type is “Checkboxes” then you have different validation tools: Select at least, Select at most and Select exactly.

We will see what each one of these validation methods means through different examples.

1. Validate email address

If you require from the respondents to enter their email address then the Question type should be “Text”. Then, enable the Data validation and choose these options respectively: Text > Email address. Type some custom error text.

validate email address in google form

Notice: According to some comments I found in the Internet forums, this might not be the perfect solution. However Google can identify and recognize the most common email domains.

2. Implement CAPTCHA

In order to make sure that your form is being filled by a human and not a computer robot, it is highly recommended to ask your respondents some logical question. I usually place this question right before my respondents hit the Submit button.

For “Question type” choose “Text”, enable Data Validation, then in the first combo box choose Text, in the second choose “Not between” and finally any numbers of your choice. Mark this question as required.

Google Form Captcha

3. Ensure the exact number of answered questions

This feature will probably be utilized mostly by academic institutions. This validation mechanism ensures that student will mark the exact number of answers as it is required by the teacher. It doesn’t mean they are correct, of course.

Question type is Checkboxes. After enabling Data validation, choose “Select exactly” option and put number 3 in the next field. Provide custom error text.

Validate checkbox answers

4. Regular expressions as validation tool

If you are an advanced user you can consider to create custom regular expressions. According to a definition on the Google’s Support siteOpens in a new tab.:

“Regular expressions provide a way to identify certain types of text, including particular characters, numbers, words, or patterns of characters. Regular expressions are particularly useful in pattern matching, as these searches are not restricted to a specific search term. Instead, searches return patterns that match the expression specified.”

Let’s see some examples of form validation by using regular expressions.

Validate email address – Check if email address is from any of these domains: gmail.com, mail.com, live.com:

  • (\W|^)[\w.+\-]{0,25}@(gmail|mail|live)\.com(\W|$)

Limit the number of characters – the Paragraph text box, basically doesn’t impose certain limit on entered text, but if you want you can define maximum number of characters in specific text box. This regular expression (or shortly RegEx) ensures that answer can contain between 1 and 800 characters:

  • [\w]{1,800}

 

Milan Mihajlov

Professional Software Tester. Previously IT Specialist and Sys Admin helping many companies to improve their IT infrastructure, IT management and Help Desk.

10 thoughts on “Data validation tools in Google Forms – explained

  1. Hi, Thanks for the article. I tried to use the regular expression [\w]{10,255}, but it is not working. It always throws error. I used this regex in Text type and conditioned it as “contains”. Where am i going wrong?

    1. Hi. I tried the regex [\w]{10,255} for both question types, “Paragraph text” and “Text” , and it worked well. You could send me the link with a screenshot where the form shows an error, so I can take a look.

  2. Hello, I wanted to know if there’s a way to make it compulsory for the respondents to answer a particular question if they choose a particular option. e.g. if they choose 3 or less on a 5 digit scale, the next question labelled suggestions becomes compulsory to answer but not at a 4 or 5. Alternatively, the same question may offer an explanatory field on choice of a 3 or less.

    1. How to validate Email Address in a contact form From google .When Someone create a account in any social media site then i put a email id LIke This- A@gmail.com
      Then generate a error please enter registered email id ,then how i validate that type of email id.

  3. Hello, I want to know how to cross check login details with a database of available codes previously given out to students ( about 500 different codes). To ensure only those with the codes can login and take survey.

  4. Hello, I would like to use a Google Form to collect student subject selection choices but have some rules such as if there was a choice to choose a subject such as INDTECH1 they can not choose INDTECH2 or vice versa if they chose INDTECH2, they can not choose INDTECH1. If they choose INDTECH it can only be INDTECH1 or INDTECH2, not both. Is this possible?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

Pin It on Pinterest