title: How does Form populate `value` parameter in Scala Play framework without passing in?
body: <p>Here is the code I am playing with</p>
  
  <pre><code>  def doLogin = Action { implicit request =&gt;
       val loginRequest = loginForm.bindFromRequest.get
     Ok(s"username: '${loginRequest.username}', password: '${loginRequest.password}'")
    }
  
    def loginForm = Form(mapping("username" -&gt; text, "password" -&gt; text)
        (LoginRequest.apply)(LoginRequest.unapply))
  
    case class LoginRequest(username:String, password:String)
  </code></pre>
  
  <p>I am confused on how the <code>.get</code> was able to retrieve data, in the <a href="https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/data/Form.scala" rel="nofollow">source code</a></p>
  
  <pre><code>def get: T = value.get
  </code></pre>
  
  <p><code>get</code> retrieves the <code>value</code>, however the <code>value</code> was never populated in the companion object</p>
  
  <pre><code>def apply[T](mapping: Mapping[T]): Form[T] = Form(mapping, Map.empty, Nil, None)
  
  case class Form[T](mapping: Mapping[T], data: Map[String, String], errors: Seq[FormError], value: Option[T])
  </code></pre>
  
  <p>since I only passed in <code>Mapping</code></p>
  
  <pre><code>Form(mapping("username" -&gt; text, "password" -&gt; text)
        (LoginRequest.apply)(LoginRequest.unapply))
  </code></pre>
  
  <p>But when I </p>
  
  <pre><code>print(loginForm.bindFromRequest.get)
  </code></pre>
  
  <p>it does return the loginRequest object, I am confused on where the <code>value</code> parameter get populated, as it should be <code>None</code> judging from the <code>apply</code> method in the companion object of <code>Form</code></p>