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.

1
  • 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. Commented Mar 28, 2013 at 9:19

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.