// Add a text item to a form and require it to be a number within a range.constform=FormApp.create('My form');consttextItem=form.addTextItem().setTitle('Pick a number between 1 and 100?');consttextValidation=FormApp.createTextValidation().setHelpText('Input was not a number between 1 and 100.').requireNumberBetween(1,100).build();textItem.setValidation(textValidation);
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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,[]]