Closed mcbmcb0 closed 2 years ago
Can you create an example with https://codepen.io/pen?template=pBxBXm ?
I'm trying to reproduce what you describe before making a change but it's not clear to me (field is still editable if onreset returns false).
see here: https://codepen.io/mcbmcb0/pen/EqxBBw note on codepen returning false from onreset blocks future editing when clicking either save and cancel. (i made a jsfiddle and it behaved the same). On my local version only 'cancel' will trigger onreset (which returns false). I think this difference is because on codepen there is nothing coming back from the server (via ajax).
either way, in that codepen if you comment out the return false you will see the problem goes away - OR in jeditable try moving that 'self.editing = false' line for a solution
@mcbmcb0 Thank you for the codepen. I'll try and have a look at the code. Now that there is a reproducible case, it'll be easier to pin down :)
using 2.0.11 / 2.0.12 onreset provides the user a way to change the reset action and if it returns 'false' then the native reset is overridden:
$('.edit_area').editable(AjaxManager_file, {...
onreset: function(settings, original) {// before reset
// -- my code here --;
return false;// <---
},...
But if false is returned then the field is no longer able to be edited. the problem is e L459self.editing = false;
is within a conditional statement that is not run if false is returned. So self.editing remains true. I cant think of why this would be required.Solution: move that line out side of the conditional statement, ie after L467. Then onreset can properly override the native function as the user wishes. Fixed!
Thanks