Skip to content

No error callback #13

@russen

Description

@russen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions