title: How to handle Long and different formats in a Play! Scala form?
body: <p>In my model all associated accounts are <code>Long</code> not normal integers. However, when handling the Scala form in the new Play! 2.0 I can only validate an <code>Int</code> number in a form and not a <code>Long</code>.</p>
  
  <p><a href="http://www.playframework.org/documentation/2.0/ScalaForms" rel="noreferrer">http://www.playframework.org/documentation/2.0/ScalaForms</a></p>
  
  <p>Take the following form: </p>
  
  <pre><code>val clientForm: Form[Client] = Form(
      mapping(
        "id" -&gt; number,
        "name" -&gt; text(minLength = 4),
        "email" -&gt; optional(text),
        "phone" -&gt; optional(text),
        "address" -&gt; text(minLength = 4),
        "city" -&gt; text(minLength = 2),
        "province" -&gt; text(minLength = 2),
        "account_id" -&gt; number
      )
      (Client.apply)(Client.unapply)
    )
  </code></pre>
  
  <p>Where you see <code>account_id</code> I want to apply a <code>Long</code>, so how could I cast that in the simplest way possible? The <code>Client.apply</code> syntax is awesome for its simplicity but I'm open to options like mapping. Thanks!</p>