title: playframework - how to set a select input in scala
body: <p>So I have a form on a page, and I am trying to pre load all the old value when the page loads up. But I am having some trouble achieving this for the select object.</p>
  
  <p>I have the following scala code for generating the select:</p>
  
  <pre><code>&lt;select id="networkInterfaces"&gt;
              &lt;option value=""&gt;First Available&lt;/option&gt;
              @for(interface &lt;- networkInterfaces) {
                  @if(interface.Name == configs.last.networkInterfaceName) {
                      &lt;option selected="selected" value="@interface.Name"&gt;@interface.DisplayName&lt;/option&gt;
                  } else {
                      &lt;option value="@interface.Name"&gt;@interface.DisplayName&lt;/option&gt;
                  }
              }
          &lt;/select&gt;
  </code></pre>
  
  <p>And when the page loads it does show that the selected network interface is selected. But the problem is if I change some of my other settings and submit it is returning the options html not the value. Is there a way to select the form value for the select in scala while the page is loading?
  Is there something fundamental I am missing? Otherwise I will change the way it is handled to process display name rather than value...</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>As I could not get this to work i changed the value to @interface.DisplayName and then converted it in code on the server. I would like to be able to do it properly but it doesnt seem to work.</p>