Submit a Form using Google App Script's HtmlSe

2019-05-04 20:07发布

I am having issues calling the server side GAS function on form submission in a html form that was created using HtmlService. The HtmlService documentation says that the following should work:

<form id='myForm'>
  <input name='myFile' type='file'>
  <input name='aField'>

  <input type='button' onclick='google.script.run.processForm(this.parentNode)'>
</form>

I'm using something similar:

<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>

And though I have done almost the same thing that the documentation says will work for form submissions, my server side function doesn't get called. Can someone tell what I may be doing wrong and how I may be able to fix this.

1条回答
仙女界的扛把子
2楼-- · 2019-05-04 20:42

Currently this issue is being track at here, the form in HtmlService is having some problem. There is a workaround provided at "how to get value entered in UI created with the new HtmlService" but it does not work well if you are going to do with files as it only works with text.

查看更多
登录 后发表回答