diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1d8bb37..d21f5b0 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -18,7 +18,7 @@ Version 1.2.0 wip
[enh] new option: 'display' callback. Makes far more flexible rendering value into element's text. (vitalets)
[bug] fix typos (atrophic)
[enh] all callbacks scope changed to element (vitalets)
-[enh] new option: 'cancelnochange' to cancel or submit value when it was not changed in form (vitalets)
+[enh] new option: 'savenochange' to save or cancel value when it was not changed in form (vitalets)
[enh] composite pk can be defined as JSON in data-pk attribute (vitalets)
[enh #30] new option 'sourceCache' true|false to disable cache for select (vitalets)
[bug #34] inputclass span* broken with fluid bootstrap layout. Classes changed to 'input-*'. (vitalets)
diff --git a/src/editable-form/editable-form.js b/src/editable-form/editable-form.js
index 07d6459..e08a454 100644
--- a/src/editable-form/editable-form.js
+++ b/src/editable-form/editable-form.js
@@ -181,7 +181,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//if value not changed --> cancel
/*jslint eqeq: true*/
- if (this.options.cancelnochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {
+ if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {
/*jslint eqeq: false*/
this.cancel();
return;
@@ -484,14 +484,14 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
**/
scope: null,
/**
- Whether to cancel or submit value when it was not changed.
+ Whether to save or cancel value when it was not changed but form was submitted
- @property cancelnochange
+ @property savenochange
@type boolean
- @default true
+ @default false
@since 1.2.0
**/
- cancelnochange: true
+ savenochange: false
};
/*
diff --git a/src/element/editable-element.js b/src/element/editable-element.js
index e7ccf3a..08dda47 100644
--- a/src/element/editable-element.js
+++ b/src/element/editable-element.js
@@ -97,6 +97,7 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@event init
@param {Object} event event object
@param {Object} editable editable instance
+ @since 1.2.0
**/
this.$element.triggerHandler('init', this);
}, this));
@@ -522,7 +523,6 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@default 'click'
**/
toggle: 'click',
-
/**
Text shown when element is empty.
diff --git a/test/unit/common.js b/test/unit/common.js
index 06100ea..ec685db 100644
--- a/test/unit/common.js
+++ b/test/unit/common.js
@@ -390,10 +390,10 @@
});
- asyncTest("cancelnochange: true", function () {
+ asyncTest("savenochange: false", function () {
var v = 'abc',
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-no.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
- cancelnochange: true
+ savenochange: false
}),
req = 0;
@@ -418,10 +418,10 @@
}, timeout);
});
- asyncTest("cancelnochange: false", function () {
+ asyncTest("savenochange: true", function () {
var v = 'abc',
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-yes.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
- cancelnochange: false
+ savenochange: true
}),
req = 0;