title: Custom Meteor autoform template
body: <p>I have nested schemas. Using <code>{{&gt; afQuickField name='work_item' template="myTemplate"}}</code> outputs the inputs in a very logical way, but for some of my more complex objects this isn't terribly practical. I'd like to set up a template where I can precisely place each input with some other html. </p>
  
  <p>These are also (usually) arrays of objects, so the <code>.autoform-add-item</code> and <code>.autoform-remove-item</code> button functionality is very nice and I would like to keep it.</p>
  
  <p>How would I define custom templates for particular nested schemas and call them in my main form? </p>
  
  <p><strong>Have tried</strong></p>
  
  <p>Creating a <code>&lt;template name="afWorkItem_myTemplate"&gt;</code> named like my custom form templates extrapolated from the bootstrap3 form templates. I then try to call it like <code>{{&gt; afWorkItem name='work_item' template="myTemplate"}}</code> but that did not work at all. </p>
  
  <p><strong>update</strong></p>
  
  <p>I tried to modify my custom <code>afArrayField</code> template to output different structures based on <code>arrayFieldName</code>. This seemed a little closer but still no cigar. </p>
  
  <pre><code>Template.afArrayField_autoupdate.helpers({
    whichTemplate: function(templateName){
      return this.arrayFieldName === templateName;
    }
  });
  </code></pre>
  
  <p>Then in <code>afArrayField_autoupdate</code> template:</p>
  
  <pre><code>{{#if whichTemplate 'address'}}
    {{&gt; afQuickField name=this.current.street options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
    &lt;br /&gt;
    {{&gt; afQuickField name=this.current.city options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
    {{&gt; afQuickField name=this.current.state_id options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
    {{&gt; afQuickField name=this.current.zip options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
    &lt;br /&gt;
    {{&gt; afQuickField name=this.current.address_type_id options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
    {{&gt; afQuickField name=this.current.active_address options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
  {{else}}
    {{&gt; afQuickField name=this.name label=false options=afOptionsFromSchema template="autoupdate" placeholder="schemaLabel"}}
  {{/if}}
  </code></pre>
  
  <p>Which came very close but all of my fields (including ones that are selects if I simply use the afQuickField method in the else block) came out as text inputs. </p>