dachcom-digital / pimcore-formbuilder

Pimcore Formbuilder - create forms easily!
Other
92 stars 47 forks source link

[IMPROVEMENT] Success message displays path when redirecting to another page #416

Closed JoeyNtriga closed 2 months ago

JoeyNtriga commented 1 year ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Hi,

I've recently observed that when the output workflow is configured to redirect to another page, the success message displayed above the form shows the path to the redirection target. While this may not be an issue in most cases, it can become confusing when the form shares a page with other content and the user navigates back to that page.

Wouldn't it be better to simply not display a success message when the redirect option is selected?

Screenshot 2023-10-13 at 10 45 18
solverat commented 4 months ago

@JoeyNtriga This will change in FB 5.1. And it will be a kind of breaking change for the json response (redirect path will be no longer available in message block of type success.

Examples

Scenario 1: Success Management of type simple text or snippet:

JSON Response

// success
{
  "success": true,
  "redirect": null,
  "messages": [
    {
      "type": "success"
      "message": "Thanks"
    }
  ]
}

// error
{
  "success": false,
  "redirect": null,
  "messages": [
    {
      "type": "error"
      "message": "An error occured"
    }
  ]
}

FlashBag (only for submission via browser-redirect): message added to section success or error.


Scenario 2: Success Management of type redirect to document:

{
  "success": true,
  "redirect": "/en/my-page-after-form-submission",
  "messages": [
    {
      "type": "redirect_message",
      "message": "You'll be redirected"
    }
  ]
}

FlashBag: message added to section formbuilder_redirect_flash_message.