Note that there are some explanatory texts on larger screens.

plurals
  1. POplayframework - setting a list parameter in a custom select tag
    text
    copied!<p>I have some repetitive select tags in my html therefore I want to create a custom select tag in play which will take as a parameter the name attribute of select (which can be done easily) and a list object through which I create option tags dynamically.</p> <p>Basically I want to do something like this</p> <pre><code>////// custom tag stored in FormSelect.html/////// &lt;select name="${_selectName}"&gt; #{list ${_options}, as: 't'} &lt;option value="${t.Description}"&gt; ${t.Description} &lt;/option&gt; #{/list} &lt;/select&gt; ///////calling the custom tag from another html file////////// Type: #{FormSelect selectName:'typ', options:types /} Region: #{FormSelect selectName:'reg', options:regions /} </code></pre> <p><strong>types</strong> and <strong>regions</strong> variables are <strong>Vector</strong> and are forwarded from controller. I want <strong>${_options}</strong> at select tag (inside <strong>#{list}</strong>) to take the values of <strong>types</strong> and <strong>regions</strong></p> <p>When I excecute the above code I get this exception</p> <pre><code>Template execution error Execution error occured in template /app/views/tags/FormSelect.html. Exception raised was MissingMethodException : No signature of method: Template_1002.$() is applicable for argument types: (Template_1002$_run_closure1_closure2) values: [Template_1002$_run_closure1_closure2@127a1d8] Possible solutions: _(java.lang.String), is(java.lang.Object), run(), run(), any(), get(java.lang.String). In /app/views/tags/FormSelect.html (around line 2) 1: &lt;select name="${_selectName}"&gt; 2: #{list ${_options}, as: 't'} 3: &lt;option value="${t.Description}"&gt; ${t.Description} &lt;/option&gt; 4: #{/list} 5: &lt;/select&gt; </code></pre> <p>thx in advance</p>
 

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