Open dbrgn opened 10 years ago
Yes, this is possible, the remote
validation uses the jQuery ajax object, so this is possible (example from packages.js
):
...
remote: {
url: "/packages/check",
type: "post",
error: function () {
alert('Remote validation failed');
},
data: {
'package': function () {
return $('#packageId').val()
},
'name': function () {
return $("#name").val()
},
csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]', '#packageform').
}
}
...
Validation does AJAX requests to check-URLs.
Is it possible to easily add an error-alert if the request fails, @d22?
A possible case where this is needed is if CSRF validation fails (e.g. because the user enabled secure cookies but doesn't use TLS).