using preSubmit to prevent ajax call
using preSubmit to prevent ajax call

Great job on the Editor. I have one issue, is there a easy way to when inline with tab, to stop Ajax calls if data does not changes. I got this far, bat I'm stuck.
```
var openVals;
editor3
.on( 'open', function ( e, type ) {
if ( type === 'inline' ) {
openVals = JSON.stringify( editor3.get() );
...
.on( 'preSubmit', function ( e ) {
if ( openVals == JSON.stringify( editor3.get() ) ) {
//something to put here to stop Ajax and change filed back to text???
}
} );
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
OK, that was easy. I added close() and it works now. Is that the best way to handle that?
```
.on( 'preSubmit', function ( e ) {
if ( openVals == JSON.stringify( editor3.get() ) ) {
editor3.close();
return false;
}
} );
Well, it's not working too good, tabbing now is not working. Please help.
This is something that will be built into Editor 1.5 which will be available next week. If you can hang on until that release it will "just work".
Allan
Awesome, do you have docs on how will it work?
The documentation for 1.5 hasn't been published yet (it will be when 1.5 is available). However, it does this internally - no additional code is required. It will check to see if there are any changes before submitting the data, and if not it just executes the form close code. There is also an option to have it submit, even if there is no change, but that is not enabled for inline editing.
Allan