Peter
Peter

Reputation: 29857

Syntax for nesting grails function calls in GSP (dynamic values in ${remoteFunction} as parameter to <g:remoteLink>

I am having trouble working out the correct way to quote the following call so that it correctly renders. Because 'remoteFunction' is called as a parameter to after="", I can't use double quotes within it, and therefore the ${pictureInThread.id} is rendered literally rather than called. If I change the single quotes to double, it breaks as it terminates the after=" early.

Note I have removed the other parameters to remoteLink in the below example for readability purposes.

<g:remoteLink after="${remoteFunction(controller:'voting',action:'computeScore',update:'${pictureInThread.id}')}">

Upvotes: 0

Views: 544

Answers (1)

schmolly159
schmolly159

Reputation: 3881

Have you tried:

<g:remoteLink after="${remoteFunction(controller:'voting',action:'computeScore',update:pictureInThread.id)}">

Since you are already in a Groovy script block you should be able to reference the variable directly.

Upvotes: 1

Related Questions