I would like to validate text entries in a google form comparing them with a string list in a spreadsheet (something like "4ycTU"). Both files, form and spreadsheet, are in the same directory. So far, I got the string values in an array but I can't figure out how to compare them with the user text entry in the validation.
function idValidation() {
// get the form directory
var form = FormApp.getActiveForm();
var formFile = DriveApp.getFileById(form.getId());
var folder = formFile.getParents().next();
// get data from the spreadsheet in an array
var idSheetID = folder.getFilesByName("identificativi").next().getId();
var idSheet = SpreadsheetApp.openById(idSheetID).getActiveSheet();
var idValues = idSheet.getRange(1,2,idSheet.getLastRow()).getValues();
// create the validation rule
var idVal = Formapp.createTextValidation();
.setHelpText("Inserisci un codice identificativo valido.");
.???
}
Is there a way to do this? Thanks a lot.