How can I save and exit from the middle of editing an already completed multipage webform submission? I've got a multipage webform I'm letting users edit after they submit. There are many pages, and I don't want to force the user to go all the way to the last page to save. Is there a way to submit/save the form either with a Save Draft button, or when they use the prev/next buttons? Or is there a way to programmatically save the edited form ? That would also work.
This question is about editing a completed submission, not creating a new submission.
I've tried adding the submit button to every page, but it seems to function like a next button. If I set rebuild to false, the I can exit the edit process where I want, but the changes are not saved.
I've also tried manually adding a save draft button copied from the webform submission form, but that also did not work, failing the way the submit button did.
I was able to get this to work like so:
In a form alter, make the Submit button visible, and change the name.
   if (stristr($form_id, 'edit_form') !== FALSE) {
    $form[&quot;actions&quot;][&quot;submit&quot;]['#value'] = t('Save &amp; Exit');
    $form[&quot;actions&quot;][&quot;submit&quot;][&quot;#access&quot;] = TRUE;
    $form[&quot;actions&quot;][&quot;submit&quot;][&quot;#_webform_access&quot;] = TRUE;
    // Add a custom submit function so we can redirect the edit form.
    $form['actions']['submit']['#submit'][] = 'mymodule_webform_submission_form_submit';
    $form['actions']['submit']['#validate'][] = 'mymodule_webform_submission_form_validate';

  }

Next, in the custom validation function:
  // If this is the edit form, and the submit button is the trigger, always
  // do the final submit by setting the current wizard page to the confirmation
  // page.
  $trigger = $form_state-&gt;getTriggeringElement();
  if ($trigger[&quot;#id&quot;] == 'edit-actions-submit' &amp;&amp;
    stristr($form['form_id']['#value'], 'edit_form') !== FALSE) {
    $form_state-&gt;set('current_page', 'webform_confirmation');
  };

Finally, in the custom submit function:
$build = $form_state-&gt;getBuildInfo();
$callback_object = $build['callback_object'];
$entity = $callback_object-&gt;getEntity();
$source = $entity-&gt;getSourceEntity();
if (!is_null($source)) {
  $nid = $entity-&gt;getSourceEntity()-&gt;id();
  $form_state-&gt;setRedirect('entity.node.canonical', ['node' =&gt; $nid]);
  $form_state-&gt;setRebuild(FALSE);
  \Drupal::messenger()-&gt;addStatus(&quot;Your work has been saved.&quot;);
}

While this answers my question, it leaves me having to deal with potential errors from conditionally required fields affected by whatever changes the user is trying to save.