title: Meteor how to access different documents in a form
body: <p>I have a simple form that uses a couple different helpers :</p>
  
  <pre><code>&lt;select class="form-control"&gt;
      {{#each openTables}}
          &lt;option&gt;Table {{tableNumber}}&lt;/option&gt;
      {{/each}}
  &lt;/select&gt;
  &lt;select id="working-servers" class="form-control"&gt;
      {{#each workingServers}}
          &lt;option&gt;{{name}}&lt;/option&gt;
      {{/each}}
  &lt;/select&gt;
  &lt;input id="num-of-guests-select" type="text" value="" name="num-of-guests-select"&gt;
  </code></pre>
  
  <p><code>openTables</code> and <code>workingServers</code> are global helpers that access different collections</p>
  
  <pre><code>Template.registerHelper('openTables', () =&gt; {
      let openTables = CurrentTables.find({occupied : false});
      if(openTables) {
          return openTables;
      }
  })
  Template.registerHelper('workingServers', () =&gt; {
      let servers = Servers.find({working : true});
      if(servers) {
          return servers;
      }
  });
  </code></pre>
  
  <p>My question is basically : I am trying to update a document in that <code>CurrentTables</code> collection with the information from the form.</p>
  
  <pre><code>Template.newTableModal.events({
      'click #sendTable' : function(event, template) {
          event.preventDefault();
          event.stopPropagation();
  
      }
  });
  </code></pre>
  
  <p>In that event function, how do I access the data context of those select boxes? For example, </p>
  
  <pre><code>{{#each workingServers}}
  &lt;option&gt;{{name}}&lt;/option&gt;
  {{/each}}
  </code></pre>
  
  <p>each of the objects in <code>workingServers</code> has an ID that I want to be able to access in that event function :</p>
  
  <p><code>CurrentTables.update(tableId?, {$set: {"serverId" : ??, "currentGuests" : ??}});</code></p>
  
  <p>How do I access those documents in relation to the document in the form when I make it? Rather, how do I get that <code>serverId</code> from the document selected in that <code>workingServers</code> loop.</p>
  
  <p>Is there a better way to do this kind of thing because I need to be able to do similar forms in the future? I mean I know I <em>could</em> take the name value ,
  <code>$("#working-servers").val()</code> and look up in the <code>Servers</code> collection to find the ID that matches but that seems really bad.</p>