Frequently Asked Questions


What should be on backend side?

X-editable has no limitation to backend side, you can write it on any server language you prefer.
The common logic is:

  1. read pk, name and value from request (POST by default).
  2. Validate value:
  3. If validation failed - return HTTP status != 200 (e.g. 400 Bad Request) and error message in response body.
  4. If validation succeed - update object in database and return HTTP status = 200 with empty body.

Data is not submitted to server! Why?

The most possible reason is that you have empty pk or url options.
If you want to submit data without pk please set send option to "always".

Also form is not submitted if you did not change value. To manage this behavior see savenochange option.


How to change what is submitted to server?

You may define params as function:

$('#field').editable({
  ...        
  params: function(params) {  //params already contain `name`, `value` and `pk`
    var data = {};
    data['id'] = params.pk;
    data[params.name] = params.value;
    return data;
  }
}); 

How to submit stringified JSON?

You may define params as function and make conversion there:

//submit in JSON format        
$('#field').editable({
  ...        
  params: function(params) {
    return JSON.stringify(params);  //note: for older browsers you may need json2.js from json.org
  }
});  

How to customize editable element style?

Overwrite css classes, e.g.

a.editable-click {
  color: green;
  border-color: green;
} 
a.editable-click.editable-disabled {
  color: black;  
  border-bottom: none;
}
a.editable-empty
  color: gray;
  font-style: italic;
}

How to create my own widgets / complex form?

To create new input type (widget) just have a look on sources in inputs directory.
All inputs a derived from abstract.js, code is commented.

I'm very often asked how to create complex widgets like address input:
Please consider, that x-editable main power is quick edit of single value that is stored in single database field.
If you want to have full featured form with several fields, just render it in hidden DIV and display by click. You don't need x-editable for that.


How can I support development of X-editable?

All your ideas and feedback are very appreciated! Please feel free to open issues on github or send me email.

I'm also grateful for your donations:

or via Gtitip:

Thank you!

List of donators:

  • David Aronchick - $25
  • yolcu-iskender.com - $13
  • Ian Mayo - $50
  • Rene van de Peppel - $25
  • Nihad Hafiz - $20
  • Divan Moller - $15
  • Csstech - $100
  • Tony Dark - $40
  • Clint Morgan - $50
  • Alexander Galkin - $5
  • Kirsty Forrester - $50
  • Sébastien Arbogast - $20
  • Tony Dew - $50