jto/validation — pull request #25 by Timshel (2014-12-23 13:30:15+00:00)
Title: [Forms] Implement the [] rule for UrlFormEncoded

When a parameter is specified multiple time as in :

val data = Map("field" -> Seq("value1", "value2"))
From[UrlFormEncoded] { __ => (__ \ "field").read[String] }.validate(data)

The validation fail with `error.required`

Failure(List((/field,List(ValidationError(error.required,WrappedArray())))))

This is not practical and the error message dot not match the problem (`\ field` has been transformed to `\ field \ 0` and `\ field \ 1`).

This transformation is only needed for select multiple I believe and is incompatible with having multiple input in the same page (with some hidden for example) or just an url with multiple times the same parameter (not very useful but the `error.required` do not match the problem).

This PR implement the same logic than in Play [`Form.scala`](https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/data/Form.scala#L93-L94) :

case (s, (key, values)) if key.endsWith("[]") => s ++ values.zipWithIndex.map { case (v, i) => (key.dropRight(2) + "[" + i + "]") -> v }
case (s, (key, values)) => s + (key -> values.headOption.getOrElse(""))