I am having big troubles get Multiselect to work with my Play 2.0 application.
I have tried different solutions that I found on google, but none works for 2.0.1.
Do you have any guides or tips for getting multi select to work ?
The html...
<select multiselect="multiselect" ... name="groupIds[]"> ... </select>
The Form
class UserAdminForm{
public Long[] groupIds;
}
and later in request handler...
Form<UserAdminForm> form = uform.bindFromRequest(); // Bam , [NumberFormatException: For input string: ""]
Are there any good way of dealing with POST array ?
I had the same problem, I thing multiselect form helper is a bug in Play 2. Any way, I'd fixed it by renaming the select as @name[]. So you create a template for ex. selectMultiple.scala.html containing this code:
Having in your model a list for mapping the component, you use this template in your html page like:
Hoping this help you! (note that I'm using Play for Scala)
You can create a template like the following :
You can find this example at play-framework discussion group
You error is:
This means that you are receiving an empty String, which can't be turned into a number. Better mark the field in the Form as optional if it's possible to not get a value in that field.
Please see my example below play 2.2
The options for the multi-select dropdown are in the data HashMap