We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10289
    • 14 Posts
    Hi,

    My client is has a custom form which captures customer information and then posts it to a remote website.

    I have template’d the form without issue and it posts information correctly. However since the post ’action’ is a Url it removes control from eForm which I want to use to send a thank you email with a voucher in it.

    So basically the steps I’d like to achieve are:

    user enters data.
    submits form to remote website.
    receives thank you email.

    Is this going to be possible?

    Thanks in advance for any help or pointers recieved.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You might be able to do something with a second form posting to the remote site with a bunch of hidden fields, and use javascript to populate the hidden fields and submit the form on the main form’s being submitted. There would be no way to validate the posted values, however.

      Maybe better, have a form on your thank-you page, hidden, and triggered by javascript. Come to think of it, does eForm provide the placeholders for the form fields for the thank-you tpl? If it doesn’t, you could store the fields in the SESSION and get at them that way. In any case, triggering the form posting by javascript on the thank-you page would make sure that valid values are being sent. Of course, the email would be sent whether or not the remote processing succeeded or not; that’s why payment gateways have a back-and-forth conversation with your server, you send them data, they send you a response with more data, and then you do whatever you want with it (such as send an email).

      To be honest, I’m not so sure I’d use eForm in a case like this. You really need to send the data to the remote server, and it needs to send you a success/failure response before you send off any email. Or at least there needs to be some mechanism where somebody is notified that the processing failed if it does.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org