Hello. I'm new to Grails and playing around with forms. I want to pass the form element to the onComplete event. However, this works with the onLoading event but not the onComplete.

The 'this' keyword now relates to the response it seems instead of the form element.

Essentially I want to maintain the form element to recover it within the wait_page_toggle function. Is there a way to achieve this? Maybe I should pass the form element id as a parameter, but I doubt that I could recover this in the jquery.

Here is an exact from my code showing the form...

<g:formRemote
name="login"
url="[controller:'user',action:'login']"
update="login"
onLoading="wait_page_toggle(this)"
onComplete="wait_page_toggle(this)"

>
<label for="login">Login:</label><g:textField name="login" />
<label for="password">Password:</label><gasswordField name="password" />
<input class="button" type="submit" value="Login"/>
</g:formRemote>

Please help. Probably obvious but I'm still trying to find my feet in the framework

Thanks in advance.