Blog Sections Open
Keeping eForm AJAX Results Inside a Modal Window
A modal form feels broken if submission closes the dialog or reloads the page. The fix is to submit asynchronously and replace the modal body with the response.
When eForm is rendered inside a Bootstrap modal, the default form flow often feels clumsy because validation and thank-you output refresh the whole page. A cleaner approach is to post the form through AJAX and inject the returned HTML back into the modal body.
The core pattern
- render the normal eForm form in the modal
- bind the submit event with JavaScript
- send the form to the same action URL
- replace the modal content with the returned HTML fragment
$('#TopForm').on('submit', function (e) {
e.preventDefault();
const $form = $(this);
$.post($form.attr('action'), $form.serialize(), function (html) {
$('#modal-body').html(html);
});
});
This keeps validation messages and thank-you templates in the same visual context, which is exactly what users expect from a modal workflow.
Applying Watermarks to MultiPhotos Galleries in Evolution CMS
Practical options for watermarking images in MultiPhotos when a drop-in plugin does not work as expected.
A Safer AJAX Routing Pattern for Evolution CMS with OnPageNotFound
How to route AJAX requests through Evolution CMS without relying on unsafe generic snippet execution endpoints.