Possible Duplicate:
Use of option helper in Play Framework 2.0 templates
Normal html code:
<select id = "game_duration">
<option>01 hour</option>
<option>02 hour</option>
<option>03 hour</option>
<option>04 hour</option>
<option>05 hour</option>
<option>Never end</option>
</select>
To @select of Play framework...
I tried following Tutorial but it only printed plain html of the @select tag..
I'm new to play thus can anyone please help me?
Thank you very much.
First import
helper
package(s) at the beginning of your view:So you can use that sample:
Alternatively you can also use that code without previous importing
helper
package(s)important: Try to use
options(List("01 hour","02 hour","03 hour","Never end"))
ifSeq(...)
version will fail while compiling.btw, most probably it would be better using numeric values (ie
int
- easier to store and search in DB):Also check this answer for more samples