grails select is not rendering value -
i want make select box in grails. using 2.1.0. have view page shows select box named class. not shows value. list have used in attribute of select works fine browser when render json. can make combo box work me please ? here code below :
my view page >>>
<g:form controller="admistratoraction" action="addstudent"> <table class="centertable"> <div class="height"></div> <tr> <td><label>full name :</label></td> <td><g:textfield name="fullname" id="fullname" class="field"/></td> </tr> <tr> <td> <label>admission class :</label></td> <td><g:select name="class" id="class" class="field" from="${classlist}" noselection="['':'-choose class-']"/></td> </tr> <td colspan="2" align="right"><g:submitbutton name="createsubmit" value="create" class="button" onclick="return confirm('are sure???')"/></td> </tr> </table> </g:form> here controller >>
package administrator import common.classes.classes import grails.converters.json class admistratoractioncontroller { def addstudent = { render "add student" } def classlist = { def classes = classes.executequery("select c.classes classes c") def all_class = [classes : classes] render all_class json } }
you not need convert json in order have in gsp page
class admistratoractioncontroller { def addstudent = { def n = params.fullname def c = params.class // them } def classlist = { def classes = classes.list() // pass details view 'classlist' [classlist : classes] } } create -> views/administratoraction/classlist.gsp have form ready , able ${classlist} in it
Comments
Post a Comment