Take the 2-minute tour ×

Firstly, I am using play framework 2.1.1 with Scala. I would like to add create a drop down box with name but when the user selects it , it should give me the id of the selected name in drop down box.

Secondly, In order to achieve that i would like to use a conf file or sth. similar to it. I am open to new ideas and fancy ways to implement that. I need the value(id) in my controller. In addition, i can use play framework helpers as well.


share|improve this question
"Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results." –  zero323 Oct 17 '13 at 11:37
I am not asking for code , i am asking for ideas. –  Ducaz035 Oct 17 '13 at 11:37
Why are you using a conf file for storing data? Why not directly add it in an evolution script? –  i.am.michiel Oct 17 '13 at 13:23
I don't want to use any database , but i am open for ideas rather than that. What do you suggest ? –  Ducaz035 Oct 17 '13 at 13:37
Storing data in a configuration is bad. If you don't want a database requirement on your server, use the embedded H2 database but please, don't store data in a configuration file. –  i.am.michiel Oct 18 '13 at 7:50
show 1 more comment

1 Answer

IDEA: In your configuration file, keep the association between name and id as a pair. Read the file using the typesafe configuration library. Then save the values you have read in from the config file in a data structure. When you are creating the view template that has the drop down box, read the data structure to get the name,id pairs and send those to the browser.

share|improve this answer
provider=["ProviderId","ProviderName"] , this would be my pair and i will have at least 65 of them , the question is now in order to take them from the template how can i read this conf file ? as a list or sth. ? –  Ducaz035 Oct 17 '13 at 12:15
and i am creating a new conf file called providers.conf –  Ducaz035 Oct 17 '13 at 12:19
To read from the config file use github.com/typesafehub/config –  egprentice Oct 17 '13 at 13:05
add comment

Your Answer


