Segment-email form validation errors (e.g. excludedLists conflict) surface only when the builder Apply posts the form — after all content work, naming a field the builder does not show; no preflight before launching the builder
Mautic Series
7.2.x series
Mautic installed version
7.2.0
Way of installing
I installed with composer using https://github.com/mautic/recommended-project
PHP version
8.3.32
What browsers are you seeing the problem on?
No response
What happened?
In Mautic 7.2.0, segment-email form validation (e.g. EmailListsValidator: "The same segment cannot be excluded and included in the same time") only runs when the email form is POSTed. Inside the GrapesJS builder, the first POST happens when the user clicks Apply (✓) — typically after substantial content editing. The user then gets a modal inside the builder: "Could not request your action — There are some form validation errors (excludedLists: …) Please close the builder and fix them." — about a settings field that (a) is not visible or editable anywhere in the builder, (b) may have been set long before entering the builder (the included/excluded segment multi-selects sit adjacent on the form, and nothing validates their overlap client-side), and (c) requires leaving the builder to fix. The built content is actually preserved (Apply writes the canvas into the form textareas before posting, and the failed POST does not reset the form), but nothing tells the user that — the natural reaction is "did I just lose my work?". A closely related recovery trap in the same flow: the builder panel has Apply (✓), which posts the form, and Close (✕), which only writes the canvas content into the hidden form textareas WITHOUT posting. So after ✕ the email is NOT saved even though the content is in the form. Users reasonably report "sometimes the close button saves, most of the time it does not" — it never saves; it stages content. If the user then submits the form (or navigates to a save action), it looks like ✕ saved; if they navigate away, the staged content silently disappears. Suggested directions (any one helps a lot):
- Preflight the overlap client-side before launching the builder and on form change (both fields are on the same page — same-option-in-both-multi-selects is a trivial check), so the conflict is fixed before any content work.
- When Apply fails validation, state explicitly in the modal that builder content is preserved, and ideally offer "fix fields" that closes the builder back to the form with the offending field focused/highlighted.
- Differentiate Apply vs Close semantics visibly (tooltips/labels, and an "unsaved changes staged on the form" indicator when closing after edits).
How can we reproduce this issue?
- Create a segment email. In Available Segments select segment X; ALSO select X under Excluded Segments (easy to hit — adjacent multi-selects, no client-side overlap check).
- Fill subject / internal name. Open the builder and make real content edits (move blocks, restyle, add text).
- Click Apply (✓): modal "Could not request your action — There are some form validation errors (excludedLists: The same segment cannot be excluded and included in the same time.) Please close the builder and fix them."
- Observe the builder offers no segment fields at all; recovery = close builder, edit the excluded-segments field, re-open builder, re-verify content — with no indication the content survived.
- Contrast: click Close (✕) instead — builder closes, no POST happens, built content sits unsaved in the form; navigating away discards it.
Relevant log output
Code of Conduct
- I confirm that I have read and agree to follow this project's Code of Conduct
Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.
Source: mautic/mautic