I have a webform with a single handler - an extended remote post handler that sends the submission to an external service. The entire form loads in a modal dialog and has two wizard steps.
This service can return a 200 (with confirmation id and date) or 400 (and any number of errors).
How can I either:
- Prevent the submission on error from the service, and reload the form to try again (with values retained)
- Change the confirmation message to reflect that something went wrong, and either reload the form fresh with that appended or just have a link in the modal that goes "back to form"
I have looked at a few other questions like:
- Trigger redirect after Webform Remote Post Handler posted successfully
- How do I pass a response from a Webform custom handler back to Drupal to display on the confirmation page
- Override webform confirmation and email message if token data is missing
I can't get them to work.
preprocessConfirmation() is never triggered in my handler, I don't see other examples or where that would be called. How are we supposed to implement that effectively? If there was an error saving the data to the remote service, I either want the user to try again, or just delete the webform submission in Drupal and start over.