How to Trigger Parent Page Actions After BoldDesk Web Form / Widget Submission
Enable your embedded BoldDesk web form to signal the parent webpage after a successful submission. With a small Custom JS snippet in the web form, the form sends a simple postMessage to the parent. A matching listener on the parent page then performs your chosen follow‑up action—such as reloading the page, redirecting to your site, closing a popup, or showing a confirmation.
The steps below show where to paste the Custom JS in Admin → Web Forms → Custom JS and how to add the parent page listener that reacts to the 'windowReload' message and runs the action you prefer.
Go to Admin > Web Forms > Custom JS and paste the following custom JS code.
Custom JS code for web forms
document.querySelector('.widget-success-msg-container button').addEventListener('click', () => {
const targetWindow = window;
targetWindow.parent.postMessage('windowReload', "*");
})
Parent page code
Paste the following script on the parent page.
<script>
window.BolddeskWidgetConfig = {
created: (args) => {
BolddeskWidget('open', 'popup');
},
};
window.addEventListener(
'message',
function (event) {
const receivedMessage = event.data;
if (receivedMessage === 'windowReload') {
location.reload(); // can do any action
}
},
false
);
</script>
- You can create any element inside your web form.
- You can send custom data from the web form to the parent webpage.
Frequently Asked Questions (FAQs)
1. Is it possible to enable a BoldDesk web form to signal the parent webpage after a successful submission?
Yes, it is possible to enable a BoldDesk web form to signal the parent webpage after a successful submission.
2. Where do I paste the Custom JS snippet that sends a message to the parent page after a web form has been submitted?
Paste your Custom JS snippet in Admin → Web Forms → Custom JS.