Trigger a Success Modal without redirects or closing the active modal in Forms

I am building a product catalog where product pages frequently feature one or more forms nested directly inside Cornerstone Modal elements (e.g., enquiry forms, quote requests).

We are trying to achieve a clean UX upon submission: when a customer submits a form inside a modal, we want a “Success” notification popup to appear confirming submission.

Given that a modal form submission is a primary WooCommerce/eCommerce use case, is there a native or recommended method within Cornerstone to launch a secondary “Success” Modal (or keep the parent modal open with a clear success state) upon an AJAX form submit action?

Thanks!

Hello @NineZero

Thanks for writing to us.

The native approach in Cornerstone is using Cornerstone Forms , which includes built-in AJAX submission handling and an AJAX change selectors control. This allows you to update the modal content to a success state dynamically without reloading the page or closing the modal unexpectedly.

Triggering a secondary popup modal on submit is also possible, though it usually requires a small custom JavaScript code to listen for the AJAX completion and fire the new modal.

It seems that you don’t have Cornerstone Forms yet; adding it will unlock those native AJAX controls. Additionally, if you need help dialing in the custom JavaScript and modal interactions, you need to subscribe to One Total Care, where customization questions are answered, and our team can set that up for you. Please note that custom development is outside the scope of standard theme support.

Thanks for understanding

I understand and I am using Cornerstone Forms.

The issue is that on submit the modal closes as the submit button looks hardwired to close the modal. So any Success Div I try to encorporate within the form becomes irrelevant as the modal is closed, so the user would need to repoen the enquiry form modal just to see a notification. If you look at the setup on the link below you’ll see the form modal setup.

Surely a “success” notification should be a standard action included within forms on submit?

Hello Matthew,

Thank you for the follow-up and for sharing the product page. I understand that when a form inside a Modal is submitted, the Modal closes, so the success message is never seen. The submit button is not what closes the Modal. When a form submits without AJAX, the whole page reloads. When AJAX is on but the Change Selectors list is empty, Cornerstone Forms replaces the entire page body. In both cases, every Modal goes back to its closed state. On your page, the main enquiry form has AJAX on with no Change Selectors, and the other enquiry and quote forms have AJAX off. Cornerstone Forms can show the success state inside the open Modal without any code. Please review the steps below.

  1. Turn on AJAX and set a Change Selector – Select each Form element and turn on AJAX. Under Change Selectors, add one entry that targets that form’s own ID, for example #productenquiry. Only that part of the page is then replaced after submission, so the Modal stays open. Please repeat this for each form, including #productenquirymob and the quote forms. For the quote forms built with a Looper, use the same Dynamic Content in the selector that you already use in the form’s ID, so each form only replaces itself.

  2. Add the Success Message inside the form – In the Elements library, under Forms, drag the Success Message element into the Form element itself. Placing it outside the form will not work. This element only appears when the form has been submitted without errors. For a clean result, wrap your fields and submit button in a Div and give it the condition Form > Submitted Without Errors = No. After submission, the fields are then replaced by the confirmation inside the same Modal.

  3. Keep Dynamic Rendering off on these Modals – Dynamic Rendering is currently off on your Modals, which this setup needs. If it is turned on, the form is not part of the page HTML that Cornerstone Forms reads back after submission. The Change Selector then cannot find it, and the update fails with a console error.

  4. Opening a separate, second “Success” Modal after submission is not built into Cornerstone Forms. It requires a small custom JavaScript snippet, which is included in our Custom Coding tier for ONE package subscribers. Please confirm whether your account is on the ONE package, and I will prepare that for you. The in-place success state above needs no code.

Best Regards.

That is great @ruenel I’ve restructured the primary form and have the funcionailty working by the looks of it!

Thanks very much for your support, I have no need for the secondary modal since the primary one is staying open.

You are most welcome, Matthew.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.