val userForm = Form( mapping( "name" -> text, "age" -> number,
"country" -> text
)(User.apply)(User.unapply) )
val userForm = Form(
mapping(
"name" -> text,
"age" -> number,
"country" -> text
)
).bind(Map("country" -> "US")
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/ttN2Y-nPqxUJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.
>> To post to this group, send email to play-framework@googlegroups.com.
>> To unsubscribe from this group, send email to
Ivan, thanks for the prompt response.
Unfortunately, this will not work for me since bind checks the constraints and flags error on the other fields that are not initialized. For bind to work, I will have to initialize all the fields that have constraints. Since the default initial value for some of the fields is not known, I cannot initialize all the fields.
-MG
On Wednesday, April 4, 2012 8:50:12 PM UTC-7, Ivan Meredith wrote:
err needs an extra ) at the end.
https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/api/data/Form.scala#L53
value=signupForm("country").value.map {x=>Some(x)}.getOrElse(Some("US")))