By Alvin Alexander. Last updated: April 11, 2018
As a brief note to self before I delete this code, this is how you create a drop-down list in Play Framework 2.6:
@* adding 'size to helper.select creates a select/option area (single or multi-select) *@ @helper.select( form("category"), categories, 'id -> "category", '_help -> "Select one, any one" )
In that code, categories is passed into the Play template like this:
categories: Seq[(String, String)]
I’m only deleting this code because the requirement changed and a drop-down list isn’t required in this Play Framework template; the code works just fine. Also note that I treat the category as nonEmptyText
in the form mapping in the controller.
If you needed to see how to create a drop-down list in a Play Framework 2.6 template, I hope this is helpful.