Class TextValidation
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
टेक्स्ट की पुष्टि
TextItem
के लिए DataValidation.
// Add a text item to a form and require it to be a number within a range.
const form = FormApp.create('My form');
const textItem =
form.addTextItem().setTitle('Pick a number between 1 and 100?');
const textValidation =
FormApp.createTextValidation()
.setHelpText('Input was not a number between 1 and 100.')
.requireNumberBetween(1, 100)
.build();
textItem.setValidation(textValidation);
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003e\u003ccode\u003eTextValidation\u003c/code\u003e is used to apply specific data validation rules to text-based form responses collected through a \u003ccode\u003eTextItem\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt enables defining criteria like number ranges, custom error messages (using \u003ccode\u003esetHelpText\u003c/code\u003e), and applying these constraints via \u003ccode\u003esetValidation\u003c/code\u003e on the target \u003ccode\u003eTextItem\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe example demonstrates setting a numeric constraint, requiring user input to fall between 1 and 100 with a clear error message if the input is invalid.\u003c/p\u003e\n"]]],[],null,["# Class TextValidation\n\nTextValidation\n\nA DataValidation for a [TextItem](/apps-script/reference/forms/text-item).\n\n```javascript\n// Add a text item to a form and require it to be a number within a range.\nconst form = FormApp.create('My form');\nconst textItem =\n form.addTextItem().setTitle('Pick a number between 1 and 100?');\nconst textValidation =\n FormApp.createTextValidation()\n .setHelpText('Input was not a number between 1 and 100.')\n .requireNumberBetween(1, 100)\n .build();\ntextItem.setValidation(textValidation);\n```"]]