Monday, August 17, 2009

Passing Multiple parameters to remoteFunction

JavaScript in GSP page:

${remoteFunction(controller:'processParamAssign',
action:'operList',update:'operDiv',
params:'\'mfgAreaLoc=\'+mfgAreaLoc+\'&oper=\'+oper')};

In the above line I am passing mfgAreaLoc and oper as 2 parameters to the remoteFunction operList in the controller processParamAssign. NOTE: mfgAreaLoc and oper are JavaScript variables declared before the remoteFunction call is made.

The controller action looks like this:

def operList={
println "Params:"+params
println "Oper:"+params.oper
println "mfgAreaLoc:"+params.mfgAreaLoc
}


Output is:

Params:[oper:LASERM, action:operList,
controller:processParamAssign, mfgAreaLoc:VICMRKCUT]
Oper:LASERM
mfgAreaLoc:VICMRKCUT

No comments:

Post a Comment

Thank you for your feedback