You should use the callback validate
from X-Editable:
this.$el.find("#my-field").editable({
[...]
validate : function(value) {
if (condition)
[...]
}
});
Link: http://vitalets.github.io/x-editable/docs.html#editable