Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The right type is: <code>Seq[(String, String)]</code>. It means a sequence of pairs of String. In Scala there is a way to define pairs using the arrow: <code>a-&gt;b == (a, b)</code>. So you could write e.g.:</p> <pre class="lang-scala prettyprint-override"><code>@select(field = myForm("selectField"), options = Seq("foo"-&gt;"Foo", "bar"-&gt;"Bar")) </code></pre> <p>But there is another helper, as shown in the documentation, to build the sequence of select options: <code>options</code>, so you can rewrite the above code as:</p> <pre class="lang-scala prettyprint-override"><code>@select(myForm("selectField"), options("foo"-&gt;"Foo", "bar"-&gt;"Bar")) </code></pre> <p>In the case your options values are the same as their label, you can even shorten the code to:</p> <pre class="lang-scala prettyprint-override"><code>@select(myForm("selectField"), options(List("Foo", "Bar"))) </code></pre> <p>(note: in Play 2.0.4 <code>options(List("Foo", "Bar"))</code> doesn't compile, so you can try this <code>options(Seq("Foo", "Bar"))</code>)</p> <p>To fill the options from Java code, the more convenient way is to use either the overloaded <a href="http://www.playframework.org/documentation/api/2.0/scala/index.html#views.html.helper.options$" rel="noreferrer"><code>options</code></a> function taking a <code>java.util.List&lt;String&gt;</code> as parameter (in this cases options values will be the same as their label) or the overloaded function taking a <code>java.util.Map&lt;String, String&gt;</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload