jcuWM
asked on
Grails dropdown results from <g:select>
New Grails user using Grails 2.2.1 with an external Oracle database.
Building a drop down with a list of states. The dropdown works in the browser but it has brackets and table name with every state, like this:
{STATE_CODE=AK}
My section of list.gsp that contains the state list:
<div>
	<g:if test="${params?.stateList} ">
	</g:if>
Select a state:<g:select name="testName" value="${STATE_CODE}" from="${params?.stateList} " /> 	
</div>
My section of controller.groovy file that contains the
def stateList = null
stateList = db.rows("SELECT DISTINCT STATE_CODE FROM <tablename> WHERE STATE_CODE IS NOT NULL ORDER BY STATE_CODE")
		
println "********* ${stateList.SZVSBGI_STAT_C ODE}"
params.stateList=params.st ateList?:s tateList
		
In addition, theprintln line shows, in the command window, each state like it is supposed to. AK,AL, etc
Building a drop down with a list of states. The dropdown works in the browser but it has brackets and table name with every state, like this:
{STATE_CODE=AK}
My section of list.gsp that contains the state list:
<div>
	<g:if test="${params?.stateList}
	</g:if>
Select a state:<g:select name="testName" value="${STATE_CODE}" from="${params?.stateList}
</div>
My section of controller.groovy file that contains the
def stateList = null
stateList = db.rows("SELECT DISTINCT STATE_CODE FROM <tablename> WHERE STATE_CODE IS NOT NULL ORDER BY STATE_CODE")
		
println "********* ${stateList.SZVSBGI_STAT_C
params.stateList=params.st
		
In addition, theprintln line shows, in the command window, each state like it is supposed to. AK,AL, etc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER