Editor - submit and keep open to duplicate data
Editor - submit and keep open to duplicate data
Hi all!
Description of problem:
I'm looking for the best way to proceed with a (seemingly) simple task:
I have a table with a create
button that opens an editor form to input data.
When the user is done, they want an option to submit the data to the server, but keep the form open for continued editing to add another entry (with mostly the same data).
I have added a button to the form to submit the data, but after submission the form doesn't do anything else (ie: I can press 'create' or 'duplicate' again, but the actions don't do anything).
I was fiddling with the formButtons with this:
formButtons: [
{
text: 'Cancel',
action: function() {
this.close();
},
},
{
text: 'Duplicate',
action: function(){
console.log( this );
this.submit(null, null, null, false);
this.mode('create');
}
},
'Create',
],
I'm not 100% certain this is the best path forward for me and I was hoping for some advice.
Answers
Note: the above code doesn't work for me when trying to set the mode after submit with
Uncaught Error: Not currently in an editing mode
. (I think this is expected behavior from the docs).