Pergunta


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.

Foi útil?

Solução

@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)
)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top