我在使用 HtmlService 创建的 html 表单中的表单提交中调用服务器端 GAS 函数时遇到问题。 HtmlService 文档说以下应该有效:
<form id='myForm'>
<input name='myFile' type='file'>
<input name='aField'>
<input type='button' onclick='google.script.run.processForm(this.parentNode)'>
</form>
我正在使用类似的东西:
<form id='approveForm'>
<b>Enter Notes about this Approval : </b>
<br /><br />
<textarea id = 'approvalNotes' rows='10' cols='135'>Enter notes on this approval for future reference...</textarea>
<br /><br />
<b>Request Approved?</b>
<br /><br />
<input name = "decision" type="radio" id = 'rApproval' value='Yes'/>Yes<br />
<input name = "decision" type="radio" id = 'rApproval' value ='No'/>No<br />
<input name = "decision" type= "radio" id = 'rApproval' value='Pending'/>Pending<br />
<br /><br />
<b>Set the Group/List Type : </b>
<br /><br />
<input name = "gltype" type="radio" id = 'glType' value='Group'/>Group<br />
<input name = "gltype" type="radio" id = 'glType' value='List'/>List<br />
<input name = "gltype" type="radio" id = 'glType' value='?'/>?<br />
<br />
<input type='button' value='submit' onclick='google.script.run.processForm(this.parentNode)'>
</form>
尽管我做了几乎与文档所说的适用于表单提交相同的事情,但我的服务器端函数没有被调用。有人可以告诉我我可能做错了什么以及我如何解决这个问题。
最佳答案
目前此问题正在here 上进行跟踪。 ,HtmlService 中的表单有问题。 “how to get value entered in UI created with the new HtmlService ”提供了一种解决方法,但如果您要处理文件,它就不能很好地工作,因为它只能处理文本。
关于google-apps-script - 使用 Google App Script HtmlService 提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11910003/