title: Playframework 2.0 define function in View Template
body: <p>I am working on a project using PlayFramework 2.0. After reading a bit of scala I would like to embed some dynamic code in the View template. So, I did the following:</p>
  
  <pre><code>@{
      def getMystring(sequence:Int) = {
          if(patternForm != null &amp;&amp; 
              patternForm.get().windowTreatments != null &amp;&amp;
              patternForm.get().windowTreatments.size() &gt;= sequence + 1)
              sequence+""
          else 
              "" 
      }
  }
  
  &lt;input type = "text" value = @getMystring(1)&gt;&lt;/input&gt;
  ...
  </code></pre>
  
  <p>I was quite sure it was going to work but instead I got a "not found: value getMyString Error occurred" .  Did I do something obviously wrong?</p>