Normally you would use the standard jQuery .submit()
method to do a custom backend form processing before submitting.
But your submit event handler will be triggered after the standard form validation.
Sometimes it could me inconvenient.
So, how to do a custom backend form submission processing before validation?
Magento 2 backend forms fire a custom beforeSubmit
event:
So you can subscribe to it and do a custom processing before form validation and submission.
For example:
$textarea.closest('form').bind('beforeSubmit', function() {
$textarea.val(editor.value());
$contentCompiled.val(editor.options.previewRender(editor.value()))
});