title: Complex sinatra parameter
body: <p>Javascript templates</p>
  
  <pre><code>  &lt;script type="text/x-jsrender" id="questionTmpl"&gt;
      &lt;li class="question"&gt;
        &lt;input type="text" name="survey[question]" /&gt;
        &lt;button class="add_answer"&gt;Add Answer&lt;/button&gt;
        &lt;ul&gt;&lt;/ul&gt;
      &lt;/li&gt;
    &lt;/script&gt;
  
    &lt;script type="text/x-jsrender" id="answerTmpl"&gt;
      &lt;li class="answer"&gt;
        &lt;input type="text" name="survey[answer]" /&gt;
      &lt;/li&gt;
    &lt;/script&gt;
  </code></pre>
  
  <p>Jquery</p>
  
  <pre><code> $(document).ready(function () {
  
    $("#add_question").click(function(e) {
      e.preventDefault();
      $("#questionForm ol").append($.templates("#questionTmpl").render())
    });
  
  
    $("#questionForm").on('click', '.add_answer', function(e) {
      e.preventDefault();
      console.log()
      $(this).parent().find("ul").append($.templates("#answerTmpl").render())
    });
  });
  </code></pre>
  
  <p>erb</p>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;br&gt;
  
    &lt;form action="/surveys" method="post" id="questionForm"&gt;
      &lt;input type="text" name="title" placeholder="survey name"&gt;
      &lt;button id="add_question"&gt; Add a question &lt;/button&gt;
      &lt;ol&gt;&lt;/ol&gt;
      &lt;input type="submit" value="create" id="submit_form"&gt;
    &lt;/form&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I am making a survey application in sinatra. The way I currently have it set up is to using jsrender, render templates for adding questions and adding answers. My question is regarding the names of the input text fields in the javascript templates. Basically I was wondering if there is a way to set up the parameter names so that sinatra will collect them all as a hash, using the survey[question] as a key, and an array of the survey[answer] parameters as an array of values for said key.</p>