Reputation: 1252
i want to generate a <select>
tag in Play Form
. but the option
values are not fixed. so i coded it as this:
@select(
myF("server_id"),
options(
for(s <- servers){s.getId -> s.getName}
)
)
however, the compiler tells out that:
Overloaded method value [apply] cannot be applied to (Unit)
cannot i use for
sub in option
? and how should i code? thx.
Upvotes: 1
Views: 2282
Reputation: 12850
@select
takes a sequence of (String, String)
tuples. You already have a sequence (servers
), so you just to map them to tuples:
@select(
myF("server_id"),
servers.map(s => s.getId -> s.getName)
)
Upvotes: 3