Permalink
Browse files

bugfix: getValue should return just the value, getValueID returns the…

… key/value pair
  • Loading branch information...
1 parent 7a453c4 commit 257882af275062af6663101d9944f98ff1f8c6ab @reednj committed Aug 9, 2012
Showing with 13 additions and 2 deletions.
  1. +6 −1 Source/InlineEditor.js
  2. +7 −1 Test/simpletest.html
View
@@ -249,13 +249,18 @@ var InlineEditor = new Class({
getValue: function() {
var value = '';
+
if (this.edit_input.get('tag') === 'select') {
value = this.edit_input.getSelected()[0].get('value');
} else {
value = this.edit_input.get('value').trim();
}
- return Object.make(this.options.data_id, value);
+ return value;
+ },
+
+ getValueID: function() {
+ return Object.make(this.options.data_id, this.getValue());
}
});
View
@@ -73,7 +73,7 @@
}
});
- new InlineEditor('jsonpost', {
+ var et = new InlineEditor('jsonpost', {
url: 'api/edittest.php',
method: 'POST',
data_id: '12'
@@ -84,6 +84,9 @@
method: 'POST',
data_id: '12'
});
+
+ $('v-test').innerHTML = et.getValue();
+ $('vid-test').innerHTML = JSON.encode(et.getValueID());
}
}
@@ -148,6 +151,9 @@
<div id='ta-edit'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</div>
+<div id='v-test'></div>
+<div id='vid-test'></div>
+
</div>
</body>

0 comments on commit 257882a

Please sign in to comment.