I had the same problem, I thing multiselect form helper is a bug in Play 2. In any case, I fixed it by renaming select as @name []. This way you create a template for ex. selectMultiple.scala.html containing this code:
@(field: play.api.data.Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit handler: helper.FieldConstructor, lang: play.api.i18n.Lang) @values = @{ field.indexes.map { v => field("[" + v + "]").value } } @helper.input(field, args:_*) { (id, name, value, htmlArgs) => <select id="@id" name="@(name)[]" @toHtmlArgs(htmlArgs) multiple="multiple"> @args.toMap.get('_default).map { defaultValue => <option class="blank" value="">@defaultValue</option> } @options.map { v => <option value="@v._1" @{if(values.contains(Some(v._1))) "selected" else ""} >@v._2</option> } </select> }
Having a list in your model for mapping the component, you use this template on your html page, for example:
@selectMultiple( myForm("groupsId"), myOptions, '_label -> "My MultiSelect" )
Hoping this helps you! (note that I am using Play for Scala)
source share