title: Form validation and form helper
body: <p>I still struggle with the form validation and form helpers in Play 2.0. I have this login screen that I use together with the Twitter Bootstrap. So my login form looks like this:</p>
  
  <pre><code>    @helper.form(routes.Application.authenticate, 'class -&gt; "form-horizontal") {
      &lt;fieldset&gt;
      &lt;legend&gt;@Messages("login")&lt;/legend&gt;
  
              @if(loginForm.hasGlobalErrors) { 
                  &lt;div class="alert alert-error"&gt;
                  &lt;a class="close" data-dismiss="alert"&gt;×&lt;/a&gt;
                      @loginForm.globalError.message
                  &lt;/div&gt;
              }
              @if(flash.contains("success")) {
                  &lt;div class="alert alert-success"&gt;
                  &lt;a class="close" data-dismiss="alert"&gt;×&lt;/a&gt;
                      @flash.get("success")
                  &lt;/div&gt;
              }
  
              @inputText(loginForm("email"), '_label -&gt; "Email")
              @inputText(loginForm("password"), '_label -&gt; Messages("login.password"))
  
  
              &lt;div class="form-actions"&gt;
                  &lt;button type="submit" class="btn btn-success"&gt;@Messages("button.doLogin")&lt;/button&gt;
                  @Messages("or")
                  &lt;a class="btn btn-warning" href="routes.LandingPage.index"&gt;@Messages("button.doCancel")&lt;/a&gt;
              &lt;/div&gt;              
      &lt;/fieldset&gt;
      }
  </code></pre>
  
  <p>And my twitter bootstrap field looks like following:</p>
  
  <pre><code>@(elements: helper.FieldElements)
  
  @**************************************************
  * Generate input according twitter bootsrap rules *
  **************************************************@
  &lt;div class="control-group @if(elements.hasErrors) {error}"&gt;
      &lt;label class="control-label" for="@elements.id"&gt;@elements.label&lt;/label&gt;
      &lt;div class="controls"&gt;
          @elements.input
          &lt;span class="help-inline"&gt;@elements.infos.mkString(", ")&lt;/span&gt; 
      &lt;/div&gt;
  &lt;/div&gt;    
  </code></pre>
  
  <p>This is the output:</p>
  
  <p><img src="https://i.stack.imgur.com/FRZay.png" alt="Login screen"></p>
  
  <p>What I do not understand:</p>
  
  <p><strong>1, Why is the help text visible all te time (on the right side of the input field)</strong></p>
  
  <p><em>The help text comes from <code>@elements.infos.mkString(", ")</code></em>. So deleting this line will delete the help text. Or you can pass an empty string to supress the helptext being visible: <code>'_help -&gt; ""</code> </p>
  
  <p><strong>2, How to show only the help text if an error occurs?</strong></p>
  
  <p><em>Help text can be added when using this code: <code>@elements.errors(elements.lang).mkString(", ")</code></em></p>
  
  <p><strong>3, What are the possible parameters to pass to an input text field? I want to pass the class name as well, but I do not know how...</strong></p>
  
  <p>I can define my custom arguments to pass (i.e. class or placeholders): <code>class="@elements.args.get('_class)</code> and then I can pass it like this: <code>'_class -&gt; "classname"</code></p>
  
  <p><strong>4, Can I define more than one <code>implicitFieldConstructors</code> in one template part? Because for the checkboxes I want another fieldConstructor compared to the imput boxes and textarea, but how to do this?</strong></p>
  
  <p>Example for this: In the computer-database sample a Twitter bootstrap field is defined, but then it is used as follows:</p>
  
  <pre><code>@inputText(loginForm("email"), '_label -&gt; "Email")
  </code></pre>
  
  <p>Why is the name here inputText and not just input? Because there is also an input.scala.html?</p>
  
  <p>So, If I want to make a fieldhandler for the checkbox, how to use this? The following format is giving me errors:</p>
  
  <pre><code>@checkBoxHandler = @{ FieldConstructor(s2ftheme.constructors.checkbox.render) }
  @checkbox(loginForm("remember"), '_label -&gt; Messages("login.remeberme"))(handler = implicitFieldConstructor)
  </code></pre>
  
  <p>I get the error message:</p>
  
  <pre><code>not enough arguments for method apply: (implicit handler: views.html.helper.FieldConstructor, implicit lang: play.api.i18n.Lang)play.api.templates.Html in object checkbox. Unspecified value parameter lang.
  </code></pre>
  
  <p>I think I am missing the concept here...
  Thanks.</p>