Class Validation
驗證這個物件會為附加的資訊方塊定義驗證規則。
適用於 Google Chat 應用程式和 Google Workspace 外掛程式。
const validation = CardService.newValidation().setCharacterLimit('10').setInputType(
CardService.InputType.TEXT);
內容詳盡的說明文件
setCharacterLimit(characterLimit)
設定小工具的字元限制。
適用於 Google Chat 應用程式和 Google Workspace 外掛程式。
參數
名稱 | 類型 | 說明 |
characterLimit | Integer | 要設定的字元限制。請注意,這項限制只適用於 TextInput ,其他小工具會忽略這項限制。 |
回攻員
Validation
:這個物件用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-31 (世界標準時間)。
[null,null,["上次更新時間: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."]]],[]]