Blog Sections Open
Redirecting FormLister to an Anchor After Submission
A compact FormLister note on preserving or adding a page anchor after a successful submission redirect.
Sometimes the form submits successfully, but the page reload sends the visitor back to the top. When the form sits lower on a long landing page, that feels awkward. The better experience is to return the user to the same block or to a dedicated result anchor.
The goal
After a successful FormLister submission, redirect to the page URL plus an anchor such as #contact or #result.
Why this can fail
Some redirect helpers rebuild the URL without preserving the fragment, because the anchor is a client-side browser concern and is not always carried through generic redirect methods automatically.
Practical fix
If your project uses a custom section or form wrapper class, update its redirect logic so the target URL includes the desired fragment explicitly.
$url = $modx->makeUrl($modx->documentIdentifier);
$modx->sendRedirect($url . '#contact');
When to use it
- landing-page contact forms
- long product pages
- pages with inline validation messages or success summaries
This is a small UX improvement, but it makes form flows feel much more deliberate.
Using bLang and DocLister in AJAX Requests
How to keep multilingual DocLister output in sync with the current bLang context during AJAX requests.
Showing Product Cards as a Grid by Default
A quick storefront note on making the catalog open in grid mode by default instead of a row-based list layout.