Edit Button which leaves the form open can't be used multiple times
Edit Button which leaves the form open can't be used multiple times
I have two submit() buttons ... one which closes the edit form after submit() ... the other one which leaves the edit form open.
But ...the one which leaves the edit form open ('Edit') can only be triggered once. The button also stays focused. I guess it's because of the function. How can I use the 'Edit' button mutliple times? And how can I show a success message if the submit() was a success
editor.edit( editRow, {
onComplete: 'none',
buttons: ( [
{
label: 'Edit',
fn: function () {
this.submit();
}
},
{
label: 'Edit & Close',
fn: function () {
this.submit().close();
}
}
] )
} );
This discussion has been closed.
Answers
That's going to close the form before the submit is complete since the submit is async. Use the callback option of the
submit
method to provide a function that will close the form. Otherwise you won't see any validation error messages.Allan
Thanks Allan. Like this?
And what about the other button ('Edit')? The one that should submit the data but leave the form open. I can only trigger it once as described above.
Yes, exactly like that.
Are you then triggering a new edit or create? Once the submit is done, it assumes that the existing edit is complete and thus you'd need to start a new edit (even if the modal is left on the screen).
Allan
Hi Allan ... yes I would like to edit again. How can I start a new edit? I tried this ...
... but I'm getting a 'Multiple values' message in the input field.
You need to tell it what you want to edit though - the
edit()
method describes the parameters that it takes.Allan
I want to be able to edit the same values as before. I just don't want to close the from each time I do this. How can this be done?
Best Regards
Just pass in
editRow
in that case.Allan