Thursday, April 01, 2010

Grails - g:select, remoteFunction and multiple params

Here is an example of using two params in a remoteFunction call or any similar remote call in Grails, which can be extended to use more than two if needed by separating subsequent params with &

            render g.select(from:workCenters, name:"workCenterCode", value:selectedValue.get(0).toString(), onChange:"${remoteFunction(controller:'processParamOverrides',action:'mfgAreaList',update:'mfgAreaLocDiv',  params:'\'workCenterCode=\'+document.getElementById(\'workCenterCode\').value+\'&endWcOpSeq=\'+document.getElementById(\'endWcOpSeq\').value+\'&orderNum=\'+document.getElementById(\'orderNum\').value' )};")

1 comment:

  1. How would you pass a Groovy variable along with Javascript variable inside the remoteFunction?

    ReplyDelete

Thank you for your feedback