title: How to get value from HTML form in Meteor Event when the form is dynamically created?
body: <pre><code>Template.dpVar.events = {
          'click .addproduct' : function  (err) {
              console.log("testing");
              console.log(result);
              for (i = 0; i &lt; result.length; i++) {
                  var Temp_Name = result[i];
                 This is the problem //var Temp_Val = document.getElementById(Temp_Name).value
                  console.log("temp name is ", Temp_Name);
  
                 productDB.insert({ Temp_Name:Temp_Val });
                 console.log("temp val is ", Temp_Val);
              }
  
          }
  }
  </code></pre>
  
  <p>HTML </p>
  
  <pre><code>&lt;template name="dpVar"&gt;
    &lt;h1&gt;variants&lt;/h1&gt; 
  
    &lt;table class="table table-responsive table-bordered"&gt;
      &lt;tbody&gt;
      {{#each variant}}
        {{#each VARIENTS}}
          {{#if $eq this.DATATYPE "Text"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;
                &lt;input type="text" id={{this.NAME}}&gt;
               &lt;/td&gt; 
  
            &lt;/tr&gt;
          {{/if}}
  
          {{#if $eq this.DATATYPE "price"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" id={{this.NAME}}&gt;&lt;/td&gt; 
            &lt;/tr&gt;
          {{/if}}
  
          {{#if $eq this.DATATYPE "color"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;
              &lt;div&gt;
                &lt;select&gt;
                  &lt;option&gt;Color&lt;/option&gt;
                  &lt;option&gt;Green&lt;/option&gt;
                  &lt;option&gt;White&lt;/option&gt;
                  &lt;option&gt;Red&lt;/option&gt;
                  &lt;option&gt;Blue&lt;/option&gt;
                &lt;/select&gt;
              &lt;/div&gt;
              &lt;/td&gt; 
            &lt;/tr&gt;
          {{/if}}
  
          {{#if $eq this.DATATYPE "boolean"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;&lt;input type="radio" id={{this.NAME}}&gt;&lt;/td&gt; 
            &lt;/tr&gt;
          {{/if}}
  
          {{#if $eq this.DATATYPE "checkbox"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" id={{this.NAME}}&gt;&lt;/td&gt; 
                &lt;/tr&gt;
          {{/if}}
          {{#if $eq this.DATATYPE "string"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" id={{this.NAME}}&gt;&lt;/td&gt; 
            &lt;/tr&gt;
          {{/if}}
          {{#if $eq this.DATATYPE "date"}}
            &lt;tr&gt;
              &lt;td class="center"&gt;{{this.NAME}}&lt;/td&gt;
              &lt;td&gt;&lt;input data-provide="datepicker" type="text" id={{this.NAME}}&gt;&lt;/td&gt; 
            &lt;/tr&gt;
          {{/if}}
        {{/each}}
      {{/each}}
      &lt;/tbody&gt;
    &lt;/table&gt;
  
    &lt;button class="btn btn-success addproduct" id="CreateNewProduct"&gt;Create new product&lt;/button&gt;   
  &lt;/template&gt;
  </code></pre>