I'm using Grails 2.3.3
with prototype as my js library.
I have an ajax call that sends over some parameters to the server that are to be bound to an object.
The ajax call that is generated always appends &_:
at the end of my parameter list. So instead of having this map: [name:bar, action:save, controller:foo]
I get [name:bar, _:, action:save, controller:foo]
(note the _:
)
When I try to do
foo.properties = params
I get the following error (on foo.errors
):
grails.validation.ValidationErrors: 1 errors
Error in object 'com.mypackage.Foo': codes []; arguments []; default message [String index out of range: 2]
End of error dump
If I remove the appended _
key from the parameter map (with params.remove('_')
) it no longer has errors.
The problem here is that this worked fine on my app with Grails version 1.3.9 but it stopped working once I made the upgrade to 2.3.3.
After upgrading prototype library, the parameters are now doubled up.
I know this is old but I somehow keep coming back to this question every time this thing happens.
Like Geek Num 88 said, updating PrototypeJS works to solve the extra underscore parameter that is sent to the server.
The second problem is happening because of a mistake in
PrototypeProvider.groovy
, see this pull request on github.You'll have to find your
PrototypeProvider.groovy
class which is usually underor