I have this problem in my view area wherein I have this <g:select> tag having an onChange attribute to retrieve the data referenced to the selected value of the said tag. Unfortunately, we’ve containted the <g:select> tag inside the <g:formRemote> so that the data will be retrieved via the URI of the <g:formRemote> without having to refresh the page.
<!-- The g:formRemote of the view -->
<g:formRemote name="formRemote" uri:[controller:'test', action:'functionCall']>
<g:select name="selectedValue" from="${['AA','BB']}"/>
${returnData}
</g:formRemote>
//The closure where the formRemote will be calling [TestController.functionCall]
def functionCall(){
println 'entered'
def returnData = ''
if(params.value == 'AA')
returnData = 'aaa'
else if(params.value == 'BB')
returnData = 'bbb'
[data:returnData]
}
The problem is we can’t find a way to retrieve the model data from the controller back to the view [in reference with <g:formRemote>] upon change of value of <g:select>.
We recenlty know that we didn’t need a
<g:formRemote>tag to have the theory to work. We lack theonChange="${remoteFunction ...}"parameter to the<g:select tag>following the format below:Where the
updateDiv,also located in the.gsp, is responsible of holding the view to be render from the controller with the closurefunctionCall.And the TestController.functionCall having this contents: