In a GSP (Groovy Server Page), I'm using <g:submitToRemote update="...">
to update a <div>
after the server-side call.
According to the tag's documentation and other sources on the web, the target <div>
can be placed arbitrarily at the page. In my testings, however, I find that the <div>
needs to surround the <g:submitToRemote>
tag.
If it does not, the <div>
will be updated with some "random" contents (i.e., parts of the form that surround the <g:submitToRemote>
tag).
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>
That's on Grails 1.3.4.
What am I missing? - Thanks