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.
Basically开发者_如何学运维 I want to do something like this
////// custom tag stored in FormSelect.html///////
<select name="${_selectName}">
   #{list ${_options}, as: 't'}
      <option value="${t.Description}"> ${t.Description} </option> 
   #{/list}
</select>
///////calling the custom tag from another html file//////////
Type:
#{FormSelect selectName:'typ', options:types /}
Region:
#{FormSelect selectName:'reg', options:regions /}
types and regions variables are Vector and are forwarded from controller. I want ${_options} at select tag (inside #{list}) to take the values of types and regions
When I excecute the above code I get this exception
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: <select name="${_selectName}">
2:     #{list ${_options}, as: 't'}
3:        <option value="${t.Description}"> ${t.Description} </option> 
4:     #{/list}
5: </select>
thx in advance
Instead of
#{list ${_options}, as: 't'}
      <option value="${t.Description}"> ${t.Description} </option> 
   #{/list}
use:
#{list items:_options, as: 't'}
      <option value="${t.Description}"> ${t.Description} </option> 
#{/list}
That should solve your current error.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论