title: Do Form POST in Google Apps Script with HtmlService?
body: <p>I'm trying to do a wizard type application with Google Apps Script. Since styling with UiApp is so pain in the rear, I'm trying with the HtmlService route. I can't get the form POST working. Here's my sample code:</p>
  
  <pre><code>// Code.gs
  function doGet(e) {
    return HtmlService.createHtmlOutputFromFile('p1');
  }
  
  function doPost(e) {
    var params = Utilities.jsonStringify(e);
    var page = HtmlService.createTemplateFromFile('p2');
    page.params = params;
    return page.evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
  }
  </code></pre>
  
  <p>p1.html</p>
  
  <pre><code>&lt;div&gt;
    &lt;form action="#" method="post"&gt;
      &lt;input type="text" id="myContents"&gt;&lt;/input&gt;
      &lt;input type="submit" value="Submit"&gt;&lt;/input&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>p2.html</p>
  
  <pre><code>&lt;div&gt;
    &lt;?=params?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The output I've gotten from clicking "Submit" on p1 is</p>
  
  <blockquote>
    <p>{"queryString":null,"parameter":{},"contextPath":"","parameters":{},"contentLength":0}</p>
  </blockquote>
  
  <p>I'm expecting the form to return data to me so that I can use the data in the consequent page. I'm wondering if this had anything to do with Caja poisoning. Any ideas?</p>