I have a radio button group like this :
<g:radioGroup name="myGroup" values="[1,2,3]" value="1" >
<p><g:message code="${it.label}" />: ${it.radio}</p>
</g:radioGroup>
Lets say that this in view named questions. User will select any answer from this and he will click a button named calculate. Which will redirect him to another action named calculate. Now in this action, how come I get the user selected answer from questions page?
Actually I will be having 70+ question on questions view page. How do I manage those? Any suggestions?
Thanks in advance.
Matching your example the answer will be in the
myGroupparameter:I suggest renaming
myGroupto a more meaningful name such as “question” plus its index e.g.question1,question2etc. to differentiate between radio groups of questions. This enables you to iterate over all request parameters and assign answers accordingly:Of course the question-answer assignment blocks depends on your specific logic/data model.