Skip to content

Commit

Permalink
[civiremote_entity] Rebuild form in case of error
Browse files Browse the repository at this point in the history
Previously on error a redirect to the destination (URL parameter) was
executed, if given. Otherwise, a redirect to the form page was executed.
Now in both cases the form is rebuild (so the entered values are kept).
  • Loading branch information
Dominic Tubach committed Sep 24, 2024
1 parent 04ffb01 commit 8c81a5a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/civiremote_entity/src/Form/AbstractEntityForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public function submitForm(array &$form, FormStateInterface $formState): void {
}
catch (ApiCallFailedException $e) {
$this->messenger()->addError($this->t('Submitting form failed: @error', ['@error' => $e->getMessage()]));
$formState->setRebuild(TRUE);

return;
}
Expand Down

0 comments on commit 8c81a5a

Please sign in to comment.