What can be the reason for attribute of domain class not being recognized in grails template? -
i have grails template _questionform.gsp
. however, question
(which attribute of question
domain class) not being recognized in template. can reason?
_questionform.gsp
<g:form action="addquestions" controller="dashboard" method="post"> <br/> question: <g:textarea name="question" required="required" value="${questioninstance?.question}"/> <br/> //.question not recognized here <!--for options--> <g:each in="${(1..<5)}" var="i"> option ${i} : <g:textfield name="option${i}" required="required" class="options"/> <br/> </g:each> subject: <g:select name="questionsubject" from="${com.dwit.research.begnas.api.subject.list()}" optionvalue="subject" optionkey="id" noselection="['':'choose subject']" required="required"/> <br/><br/> <em>correct answer: </em><br/> <!--for correct answer--> <g:each in="${(1..<5)}" var="i"> <input type="radio" name="correct_answer" value="${i}" id="rdo_option${i}"/> <label for="rdo_option${i}">option ${i}</label><br/> </g:each> <br/> <g:submitbutton name="next"/> </g:form>
question (domain class)
package com.dwit.research.begnas.api
class question {
string question boolean isskipped = false subject subject static constraints = { }
}
the problem questioninstance
variable set string
rather instance of question
.
- look @ controller renders
_questionform.gsp
. - there's
render()
method call sets view , model. - change
model.questioninstance
instance ofquestion
.
Comments
Post a Comment