Wednesday, January 6, 2010

Issues with Grails and Ajax

Currently encountering an issue with the Grails gsp tag submitToRemote. The attributes defining javascript functions called at different points in the ajax call lifecycle, do not appear to invoke user defined javascript methods.

for example:

foo() isn't being invoked here
< onsuccess="foo();" url="[action:'fooAction']" value="Run Foo">

but the following alert will occur
< onsuccess="javascript:alert('hi');" url="[action:'fooAction']" value="Run Foo">

Adding to the confusion is the fact that Grails In Action states that the javascript method signature should define a parameter which contains the HttpXmlResponse object, something the documentation doesn't mention.

Strangely, the issue does not appear with other ajax tags like remoteLink and remoteFunction.

1 comment:

  1. the examples should be g:submitToRemote, of course. Mental note: always preview.

    ReplyDelete