title: Getting value of arbitrary form element in Google Apps Script web app
body: <p>I have a Google Apps Script web app which has a form attached, for example:</p>
  
  <pre><code>&lt;form id="form"&gt;
      &lt;input type="range" min="0" max="3" name="mb1" value="0"&gt;
      &lt;input type="range" min="0" max="3" name="mb2" value="0"&gt;
      &lt;input type="range" min="0" max="3" name="mb3" value="0"&gt;
      etc...
      &lt;input id="submit" type="submit" style="display: none" onclick="this.value='Submitting ...'; google.script.run.withSuccessHandler(formSubmitted) .writeForm(this.parentNode); return false;"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The Code.gs file has a writeForm(form) function, which can access the form input values like so:</p>
  
  <pre><code>var mb1 = form.mb1;
  var mb2 = form.mb2;
  etc...
  </code></pre>
  
  <p>However, this approach is inefficient with many such inputs (I have around 80). Much better would just be to get the values when they're being processed in a loop, like so:</p>
  
  <pre><code>for(var i = 0; i &lt;= 80; i++) {
      var formItemID = "mb"+i;
      console.log(form.formItemID);
  }
  </code></pre>
  
  <p>However, this of course does not work, as it looks for form inputs with the id "formItemID". I've taken a look at some functionality of the HTMLFormElements class which should be being sent, but Apps Script doesn't seem to implement this fully, and I can't find documentation of the form.ItemName property. Is there a way to achieve this functionality without calling for each form input separately?</p>