title: Creating a custom field constructor in Play 2 (scala)
body: <p>I am trying to grok the instructions given <a href="http://www.playframework.org/documentation/2.0/ScalaFormHelpers">in the play 2 scala tutorial</a> for form template helpers. I am getting stuck in the section "Writing your own field constructors". It gives a sample template (without saying what the name of the file should be):</p>
  
  <pre><code>@(elements: helper.FieldElements)
  
  &lt;div class="@if(elements.hasErrors) {error}"&gt;
      &lt;label for="@elements.id"&gt;@elements.label&lt;/label&gt;
      &lt;div class="input"&gt;
          @elements.input
          &lt;span class="errors"&gt;@elements.errors.mkString(", ")&lt;/span&gt;
          &lt;span class="help"&gt;@elements.infos.mkString(", ")&lt;/span&gt; 
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Then it shows this code:</p>
  
  <pre><code>object MyHelpers {
    implicit val myFields = FieldConstructor(myFieldConstructorTemplate.f)    
  }
  </code></pre>
  
  <p>I am confused about how this is supposed to relate to the template. (eg, is the template file supposed to be called myFieldConstructorTemplate.scala.html?) I tried some variations on this without luck.</p>
  
  <p>I'm new to both scala and Play, but I also know play 2 and its docs are new, so I'm not sure what incredibly obvious thing I'm missing.</p>
  
  <p>thanks!</p>