4

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.

Alan Wells
  • 30,746
  • 15
  • 104
  • 152
Rijo Simon
  • 777
  • 3
  • 15
  • 35
  • I just tested your code and it worked fine. Only you might want to give the textarea input a name so that you can parse it. Try adding Logger.log(JSON.stringify(form)); in your processForm function to verify if the form is passed and the function really gets called. – jad Mar 28 '13 at 09:19

1 Answers1

2

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.

Community
  • 1
  • 1
shh
  • 682
  • 1
  • 5
  • 20