Stay organized with collections
Save and categorize content based on your preferences.
DataValidation
The base DataValidation that contains properties common to all validations, such as help text.
Validations can be added to certain Form items.
//Addatextitemtoaformandrequireittobeanumberwithinarange.vartextItem=form.addTextItem().setTitle('Pick a number between 1 and 100?');vartextValidation=FormApp.createTextValidation().setHelpText(“Inputwasnotanumberbetween1and100.”).requireNumberBetween(1,100);textItem.setValidation(textValidation);
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["\u003cp\u003eDataValidation objects define requirements for user input in Google Forms, such as specific data types or value ranges.\u003c/p\u003e\n"],["\u003cp\u003eThese validations can be applied to form items like text fields to ensure data integrity and guide user responses.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetHelpText()\u003c/code\u003e retrieves the message displayed to the user when input fails validation, aiding in understanding errors.\u003c/p\u003e\n"]]],[],null,["# Class DataValidation\n\nDataValidation\n\nThe base DataValidation that contains properties common to all validations, such as help text.\nValidations can be added to certain [Form](/apps-script/reference/forms/form) items.\n\n```gdscript\n // Add a text item to a form and require it to be a number within a range.\n var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');\n var textValidation = FormApp.createTextValidation()\n .setHelpText(“Input was not a number between 1 and 100.”)\n .requireNumberBetween(1, 100);\n textItem.setValidation(textValidation);\n \n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------|-------------|--------------------------------------|\n| [getHelpText()](#getHelpText()) | `String` | Gets the DataValidation's help text. |\n\nDetailed documentation\n----------------------\n\n### `get``Help``Text()`\n\nGets the DataValidation's help text. This text is shown to the user if the input fails\nvalidation.\n\n#### Return\n\n\n`String` --- the DataValidation's help text"]]