Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling for validation calls #287

Open
dbrgn opened this issue Jun 1, 2014 · 1 comment
Open

Error handling for validation calls #287

dbrgn opened this issue Jun 1, 2014 · 1 comment
Assignees
Milestone

Comments

@dbrgn
Copy link
Member

dbrgn commented Jun 1, 2014

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).

@dbrgn dbrgn added this to the Iteration 7 milestone Jun 1, 2014
@dbrgn dbrgn added the bug label Jun 1, 2014
@dbrgn dbrgn assigned d22 Jun 1, 2014
@dbrgn dbrgn added the FRONTEND label Jun 1, 2014
@d22
Copy link

d22 commented Jun 2, 2014

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').
    }
}
...

@d22 d22 assigned dbrgn and unassigned d22 Jun 2, 2014
@dbrgn dbrgn modified the milestones: Iteration 8, Iteration 7 Jun 2, 2014
@dbrgn dbrgn modified the milestones: Iteration 9, Iteration 8 Jun 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants