Ameya
Ameya

Reputation: 549

remoteFunction grails

Hi I have a textArea and I have added a onkeyup event to it. When the event is triggered I want to update another element, by taking the input of the textArea and manipulating it in a javascript function. Here is my textArea tag:

<g:textArea name="translation" id="2" cols="40" rows="5" value="${domainInstance?.translation}"
                                    onkeyup="${remoteFunction(
                                    controller: 'domain',
                                    action: 'ajaxChangeTranslation',
                                    params:'\'text=\'+this.value',
                                    onComplete:'updateEntry(e)')}" />

and here is my stub javascript function:

<g:javascript>

        function updateEntry(e){
            alert("Hi");
        }
    </g:javascript>

My javascript function is never getting called. I never see the alert when I type something into the textArea. If I place an alert outside of the function the alert shows up. Why is my javascript function not getting called. When I ran it with the chrome debugger I didn't get any errors.

Upvotes: 0

Views: 1015

Answers (1)

Alidad
Alidad

Reputation: 5538

Try this:

<g:textArea name="translation" id="2" cols="40" rows="5" value="${domainInstance?.translation}"
                                onkeyup="${remoteFunction(
                                controller: 'domain',
                                action: 'ajaxChangeTranslation',
                                params:'\'text=\'+this.value',
                                onComplete :'updateEntry(XMLHttpRequest,textStatus)')}" />

Upvotes: 1

Related Questions