Reputation: 976
In my project I need to show drop down
field with multiple items selection(more than one)
. I have done drop down with single selection by using this below code
userRegisterForm.scala.html
@(userForm: Form[User],languages: Seq[(String, String)])
@select(
userForm("languages"),
languages,
'_label -> "Choose Familiar Language", '_default -> "-- Choose Language --",
'_showConstraints -> false
)
What I tried
I added 'multiple ->"multiple"
in @select
field
but it showed the all list items in drop down when page loaded.It is not like what I need.I have found this multiselect select - Play 2.0? answer from internet but I don't know how to implement those approaches in my project as I am a new to play framework
. So anyone please help me to accomplish this task.
Upvotes: 0
Views: 1557
Reputation: 11518
The HTML select
tag doesn't have the capability you're asking for.
I'd use one of the plugins. Examples:
You can copy Play's select
helper:
into your views
folder and modify it to produce the structure required by the plugin that you choose, include the .css
and .js
then there you have it. :)
Upvotes: 1