forms - Select field in grails workflow -


i have problem prefilling dropdown list in grails webflow

i have controller webflow

 class clearancerequestcontroller {  def index() {     redirect(action: "start") }  def startflow = {     contact {         on('next') {             flow.developer = params.developer             flow.project = params.project             flow.projectresponsible = params.projectresponsible             flow.email = params.email              [flow : flow]         }.to('application')         on('cancel').to('finish')    ... 

and view looks this: contact.gsp

  <g:if test="${message}">         <div class="message">${message}</div>     </g:if>     <g:form action="start" method="post">         <div class="dialog">             <table>             <tbody>              <tr class="prop">                     <td valign="top" class="name">                         <label for="projectname">projekt:</label>                     </td>                     <td valign="top">                         <input type="text" id="projectname" name="project" value="${params.project}" />                     </td>                 </tr>                 <g:select name="state" from="${project?.division_options}" value="${project?.division_options}"/> 

this project definition

  class project {  static division_options = ["a", "b", "c", "d"]  string name string division   string tostring(){     "$name" }   static constraints = {     name(unique: true)     division(inlist: division_options)   } } 

i don't know how data constraints. tried access

 project.constraints.division.inlist  

or

 project.division_options 

but both didn't worked. assume have initialize project somewhere , pass contact.gsp, don't know how.

ok got it, import project in page, like

<%@ page import="com.companyname.project" contenttype="text/html;charset=utf-8" %> 

or like:

 <g:select name="state" from="${com.companyname.project?.division_options}" value="${com.companyname.project?.division_options}"/> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -