[英]How to access the Card section input field value in Google App Script?
My card builder looks something like我的卡片生成器看起来像
function createSelectionCard(e) {
var builder = CardService.newCardBuilder();
builder.addSection(CardService.newCardSection()
.addWidget(CardService.newTextInput()
.setFieldName("text_input_form_input_key")
.setTitle("Enter Value")
.setValue('Test'))
....
return builder.build();
The documentation for Text Input says that setFieldName
Sets the key that identifies this text input in the event object that is generated when there is a UI interaction
but using e.text_input_form_input_key
always results to a null value Text Input 的文档说
setFieldName
Sets the key that identifies this text input in the event object that is generated when there is a UI interaction
but using e.text_input_form_input_key
always results to a null value
function Embed(e) {
...
presentation.getSelection().getCurrentPage().insertImage(dataBlob)
.setDescription(e.text_input_form_input_key)
}
To retrieve the imputed value from a text input, you need e.formInputs.name
:要从文本输入中检索估算值,您需要
e.formInputs.name
:
For example, your add-on can locate the text a user has entered into a TextInput widget in the
eventObject.commentEventObject.formInputs
object.例如,您的加载项可以找到用户在
eventObject.commentEventObject.formInputs
object 中的 TextInput 小部件中输入的文本。
To give you an idea, you can try with the following:为了给您一个想法,您可以尝试以下操作:
e.commonEventObject.formInputs.text_input_form_input_key.stringInputs.value[0]
For more details, you can refer to this documentation .有关更多详细信息,您可以参考此文档。
References: Event objects参考: 事件对象
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.