Grails / AJAX: updating an arbitrary region on a page using g: submitToRemote
In GSP (Groovy Server Page) I use <g:submitToRemote update="...">to update <div>after a server side call.
According to the tag documentation and other sources on the Internet, the target <div>can be placed arbitrarily on the page. However, in my tests, I found that I <div>should surround the tag <g:submitToRemote>.
If this is not the case, it <div>will be updated with some “random” content (ie the parts of the form that surround the tag <g:submitToRemote>).
Consider the following GSP code:
<html>
<head>
<g:javascript library="prototype" />
</head>
<body>
<div id="updateMe_NOT_WORKING">${message}</div>
<g:form>
<div id="updateMe_WORKING">
<g:submitToRemote value="Click Me"
action="someAction" update="updateMe_NOT_WORKING" />
</div>
</g:form>
</body>
</html>
What's on Grails 1.3.4.
What am I missing? - Thank