1

https://developers.google.com/apps-script/guides/html/communication中,该示例表明您应该在按钮 onclick 中通过“this.parent”引用表单。如果按钮不直接位于表单下方(可能有几个 div 深?this.parentNode.parentNode 等有效,但更明确的引用更适合我,那么应该如何最好地引用表单。

<form id="myForm">
    <input name="myFile" type="file" />
    <input type="button" value="Submit"
        onclick="google.script.run
          .withSuccessHandler(updateUrl)
          .processForm(this.parentNode)" />
</form>
<div id="output"></div>
4

1 回答 1

1

我想在你的情况下可能正在使用:

onclick="google.script.run
      .withSuccessHandler(updateUrl)
      .processForm(document.getElementById('formId')"
于 2013-10-11T18:29:00.067 回答