Class Validation
验证
一个对象,用于为其附加的微件定义验证规则。
适用于 Google Chat 应用和 Google Workspace 插件。
const validation = CardService.newValidation().setCharacterLimit('10').setInputType(
CardService.InputType.TEXT);
详细文档
setCharacterLimit(characterLimit)
设置 widget 的字符数限制。
适用于 Google Chat 应用和 Google Workspace 插件。
参数
名称 | 类型 | 说明 |
characterLimit | Integer | 要设置的字符数限制。请注意,此限制仅适用于 TextInput ,其他微件会忽略此限制。 |
返回
Validation
- 此对象,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-31。
[null,null,["最后更新时间 (UTC):2025-01-31。"],[[["Validation objects define rules for widgets, such as character limits and input types, ensuring data integrity."],["They are available for Google Chat apps and Workspace Add-ons, offering developers control over user input."],["Developers can leverage methods like `setCharacterLimit` and `setInputType` to customize validation behavior."],["The `setCharacterLimit` method specifically applies to `TextInput` widgets, enforcing maximum character input."],["Similarly, `setInputType` dictates the accepted input type, enhancing user experience and data accuracy."]]],[]]