Google Forms are very useful when conducting surveys, accepting applications, and so on.
However, have you ever had trouble dealing with the various formats of responses submitted?
Employee ID | Name | Phone number | Zip code |
---|---|---|---|
A00111 | Hugo First | 123-456-7890 | 12345-1234 |
b00222 | A. Mused | 0987654321 | 987654321 |
c-333 | Constance Noring | (111) 222-3333 | 11111-2222 |
D-00444 | Lois Di Nominator | 222-333-4444 | 333334444 |
I don’t want to see a lack of uniformity in format when tabulating surveys and post-application work. I think it makes the work super inefficient.
Although it is possible to format the data to some extent by using Google Spreadsheet or Excel functions, if at all possible, we would like the submission to be formatted at the time it is received.
Therefore, in this article, I would like to explain How to restrict the input format or limit the number of input characters in Google Forms, including how to use regular expressions, in addition to basic techniques.
Basics: Description and Example
First, as basic as it may sound, provide a clear explanation of what respondents should enter, and include an example.
You can post this information by pressing Description from the menu at the bottom right of the card.
For example, if you are asking for a hyphen-delimited phone number, I think it would be better to describe it as follows.
I have never lived in the US and am not very familiar with US customs… Sorry if my sample is not appropriate.
This is basic, but very important for collecting well-organized data.
Use standard validation
Google Forms makes it easy to validate and restrict input formats, even for those who are not knowledgeable about them.
You can set up an input validation by pressing Response validation from the menu at the bottom right of the card.
With this function, you can, for example, set a maximum number of entries, allow only text containing a given string of characters, allow only email address formatting, etc… and so on, with various validation and entry restrictions.
You can also set up error messages when incorrectly formatted responses are entered.
For example, to allow only the email address format to be entered, configure as shown in the image below.
If a respondent enters an incorrect value, a warning will be displayed as shown in the image below.
If such an incorrect value is entered, the response will not be submitted even if the Submit button is pressed.
As of this writing (December 13, 2022), the following validations can be set.
Rule Type | Rule |
---|---|
Number | Greater than Number |
Greater than or equal to Number | |
Less than Number | |
Less than or equal to Number | |
Equal to Number | |
Not equal to Number | |
Between Number1 and Number2 | |
Not between Number1 and Number2 | |
is number | |
Whole number | |
Text | Contains Text |
Doesn’t contain Text | |
URL | |
Length | Maximum character count |
Minimum character count | |
Regular expression | * I will explain in the next chapter. |
Set custom input restrictions using regular expressions
I explained how to set up general input restrictions, but that is not enough to handle zip codes, phone numbers, and other unique things like your company’s employee number, your customer’s membership number … and so on.
Using regular expressions, those input values can also be validated.
A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for “find” or “find and replace” operations on strings, or for input validation.
https://en.wikipedia.org/wiki/Regular_expression
For now, let’s put it into practice with Phone Number.
Select “Regular expression” and “Matches” and enter \([0-9]{3}\) [0-9]{3}-[0-9]{4}
for the pattern.
Also specify Custom error text if necessary.
This pattern means a string of “three digits surrounded by parentheses, a space, three digits, a hyphen, and four digits”.
Incidentally, the second drop-down can be selected from the following four types.
Contains | Allow strings containing the specified pattern |
Doesn’t contain | Allow strings that do not contain the specified pattern |
Matches | Allow strings that exactly match the specified pattern |
Doesn’t match | Allow strings that do not exactly match the specified pattern |
Regular expressions are deep and can be difficult to understand.
You can read Google’s help or do a Google search like “phone number regex“.
Notes on setting validation
I hope you have found that you can put quite a variety of input restrictions on Google Forms.
If you have a solid input form validation setup, it should help you because it will accumulate data that is easy to utilize.
On the other hand, however, it is important to note that respondents will not be able to submit exceptional responses.
For example, restricting the phone number as in the previous example may make it impossible for people living in other countries to submit the form.
Also, symbols such as hyphens, parentheses, and spaces may be difficult for some respondents to enter correctly.
While setting input format validation makes the survey administrator’s tabulation work more convenient, it can also be inconvenient for respondents, so it is important to carefully consider how strictly validation should be set.
In addition, note that the various numbering and code schemes are subject to change for any reasons.
Comments