I am trying to use the tag g:formRemote in grails.
In head definition:
<g:javascript library="prototype" />
view:
<g:formRemote name="something" update="remoteDocsBlock"
url="[ controller: 'document',
action: 'search']">
search: <input name="searchstring" type="text"></input>
<g:actionSubmit value="Search" action="search" />
<g:render template="/document/remoteSearchList" model="[docs:docs]" />
</g:formRemote>
<div id="remoteDocsBlock">this div is updated with the result...</div>
in my controller
def search = {
.....
render (template:'remoteSearchList', model: [docs:docs])
}
Problem
What happens: a call is made to the controller, and the entire page is replaced with the result of the controller - the template _remoteSearchList. A diffrent ajax call on the page does work. I have no idea why grails behaves like that.
Update
I have removed the "__" problem. The comment solved this question.
Update
I have isolated the Problem: JQuery. I am also using JQuery on the site. If it is removed, the ajax call works... need to find a way, to make both work.
<g:javascript library="jquery-1.4.4.min" />
<g:javascript library="jquery-ui-1.8.7.custom.min" />
<g:javascript library="jquery-server-extentions" />
Oh, seems that it's because of conflict with Prototype (bundled with Grails by default) and jQuery. Remote calls are made by Prototype lib, but if you install jQuery plugin for grails - it'll start using jquery for remote calls.