Zendesk Form: Customizing Submit Confirmation Pop-up | Community
Skip to main content

Zendesk Form: Customizing Submit Confirmation Pop-up

  • February 7, 2024
  • 2 replies
  • 0 views

Our current challenge involves editing the Zendesk form, specifically working with the code snippet "request_form wysiwyg=true." We're aiming to create a submit confirmation pop-up that displays the user's input and gives them the option to double-check before finalizing. 

Has anyone successfully customized the Zendesk form using the "request_form wysiwyg=true" code snippet? Are there specific files or sections I should focus on when attempting to customize this aspect?

2 replies

Brandon12
  • February 9, 2024

Hey @brittany14 -

For that you're gonna need to customize the script.js file.

<script>
document.addEventListener("DOMContentLoaded", function() {
    const requestForm = document.querySelector('form'); // Adjust selector as necessary
    requestForm.addEventListener('submit', function(e) {
        e.preventDefault(); // Prevent form from submitting immediately

        // Collect user inputs (adjust selectors based on your form fields)
        const userInput = {
            name: document.querySelector('input[name="name"]').value, // Example for name
            email: document.querySelector('input[name="email"]').value, // Example for email
            // Add other fields as necessary
        };

        // Create confirmation message
        const confirmationMessage = `Please confirm your details:\nName: ${userInput.name}\nEmail: ${userInput.email}\n...`; // Add all necessary details

        // Show confirmation pop-up
        if (confirm(confirmationMessage)) {
            // User confirmed, submit form
            requestForm.submit();
        } else {
            // User canceled, do nothing
        }
    });
});
</script>

Hope this points you in the right direction!

Brandon


  • Author
  • August 27, 2024

This works however after the popup appears it does not create a zendesk ticket unless you are logged in. But without the popup it does not require the user to be logged in and it will create a zendesk ticket. I am not sure why this is happening because the user is not required to be logged into zendesk for the form to be submitted.