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

No error callback #13

Open
russen opened this issue May 30, 2013 · 0 comments
Open

No error callback #13

russen opened this issue May 30, 2013 · 0 comments

Comments

@russen
Copy link

russen commented May 30, 2013

This is related to vitalets/x-editable#219

There is no 'error:' callback in x-ediable until version 1.4.4 !

The best you can do is add

$('a.editable-click').editable({
    ajaxOptions: {
      error: function (xhr, status, error) {
        if(xhr.status == 422){
          var msg = 'Error: ';
          errors = $.parseJSON(xhr.responseText);
          $.each(errors, function(k, v) {
            msg += k + ": " + v;
          });
          //Edit the response, to be more awesome.
          xhr.responseText = msg;
        } 
      }
    }
});

This edits the content of the error message before x-editable's error() callback fills it into Bootstrap's error blocks.

There's little to be 'fixed' until this gem is updated to use version 1.4.4, so I thought I'd document this problem with a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant