• Resolved frolig

    (@frolig)


    Good day to all!

    Help me solve the problem.
    I need the presentation PDF file to start downloading automatically to the client’s computer after sending the form, or a new window to open with the downloaded file.

    With a standard redirect, the file opens in the same window and exits the page, thus creating the possibility of losing the client.

    The chatGPT gave such a solution, but it does not work.

    <script>
    document.addEventListener('DOMContentLoaded', function() {

    var formElements = document.querySelectorAll('.metform-form-content');

    formElements.forEach(function(formElement) {

    document.addEventListener('metform_after_submit', function(event) {

    setTimeout(function() {

    var fileUrl = 'https://yourwebsite.com/uploads/yourfile.pdf';


    var link = document.createElement('a');
    link.href = fileUrl;
    link.setAttribute('download', '');
    document.body.appendChild(link);
    link.click();я
    document.body.removeChild(link)
    }, 1000);
    });
    });
    });
    </script>

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Support Md Abdullah Al Arif

    (@faithcoder)

    Hi @frolig,

    Thank you for reaching out to us! I’m sorry to let you know that this feature isn’t currently available in MetForm. Right now, files can only be attached to the email as a link.

    While we barely provide custom code support for such requests, we’d encourage you to submit this idea as a feature request on our plugin details page.

    We appreciate your understanding and cooperation!

    Kind Regards

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.