Reputation: 489
I have the following code in my gsp
<select onChange="${remoteFunction(action:'superior', controller:'employee', params: '\'name=\' + this.value')}">
<option>first</option>
<option>second</option>
</select>
To be specific, this code is in my _form.gsp file. The action in the EmployeeController is as follows:
def superior() {
println 'in here'
println 'these are the params: ' + params
}
It probably seems nonsensical, but my goal here is just to be able to call my remote action and pass the selected value. But I see nothing being printed to the console. If I type the URL directly as follows
app-name/employee/superior
I see my print statements on the output. So what am I missing here? I basically followed how to set this up from the grails documentation (http://grails.org/doc/2.0.x/ref/Tags/remoteFunction.html) and I have the JQuery plugin. If I use a simple javascript function on the onChange event (such as an alert) it works fine. So I'm sure my browser does not have javascript turned off, I've tested this with several browsers actually. I'm pretty sure its something very simple I'm missing. Thanks in advance.
Upvotes: 1
Views: 2600
Reputation: 8109
For me this snippet is working perfectly in firefox and chrome. So I guess you have a general javascript error on your page. Check this with firebug. If there is no error, double check the generated code for the onchange tag of your select box.
Upvotes: 1