title: In an AMT HTML Questio. for batch, how to generate all inputs
body: <p>So I've been trying to generate the contents mturk_form using the DOM model for a Amazon Mechanical Turk HTML question. I ran into an interesting error when I generated ALL inputs using the script: I get the error Dhtml template must contain a question.</p>
  
  <p>This error can be hacked around by putting an unnamed hidden input in the top of the page, like the example below. Remove the <code>&lt;input type="hidden" /&gt;</code> and the error comes back. Does anyone have a better way?</p>
  
  <pre><code>    &lt;p&gt;&lt;input type="hidden" /&gt; &lt;script&gt;
      window.onload = create_form;
      function validate()
      {
  
        var checkbox = document.getElementById("testbox");
        if (checkbox.checked)
        {
          return true;
        }
        else
        {
          alert("failed validation");
          return false;
        }
      }
      function create_form()
      {
      var turkform = document.forms[0];
      var testbox = document.createElement('input');
      testbox.type="checkbox";
      testbox.name="testbox";
      testbox.id="testbox";
      testbox.innerHTML="check to be valid";
      turkform.appendChild(testbox);
      turkform.appendChild(document.createTextNode('check to be valid'));
      var submitbutton = document.getElementById("submitButton");
      submitbutton .onclick=validate;
      turkform.appendChild(submitbutton);
      }
  
      &lt;/script&gt;&lt;/p&gt;
  </code></pre>