Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unique field validation in Google forms

Using Google forms, data can saved to the spreadsheet. Now i would like to apply validation in Username field for avoid duplication. How can add UNIQUE validation in google form field using Google script?

like image 565
Anju Avatar asked Nov 03 '14 05:11

Anju


People also ask

Can Google Forms generate a unique ID?

Google Forms automatically assigns a unique, non-sequential and non-guessable identifier (id) to every form entry. This Unique Id contains a mix of alphabets and digits. You can use this unique ID in subject line and message body of your email template with the help of dynamic form fields.

Can you add a validation to 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.


1 Answers

I think it is not possible to add validation for fields in Google form values by using Google Apps Script direcly.

One thing you can consider to change the settings in the Google form itself, if the Username field value is same as the Username that logged in to access that form. You can do this by checking the "only allow one response per person(required login)".

If the above solution does not apply for your requirement, the UiApp/Html Service in Apps Script will help you in creating custom forms.

You can create a custom form and write a custom function to get the Username field values using SpreadsheetApp class into an array. Before submitting the Form, compare the Username field from Google form with the list of username cell values that we got in an array and check for uniqueness.

Hope that helps!

like image 163
KRR Avatar answered Sep 29 '22 10:09

KRR