Forums

cformsII - contact form
How to do your own post-processing using AJAX (3 posts)

  1. Graham Swan
    Member
    Posted 1 year ago #

    I have a cForms II contact form set up. It works perfectly if I just want the results emailed to myself (default behavior).

    I now have a custom PHP file that will take the POST data from the form and submit it to an external database for me. However, when I set the Alternative Form Action page to this PHP page, clicking the Submit button just causes the form to hang.

    How exactly do I pass the form data to my own PHP file while still keeping AJAX enabled (so form validation works)?

    Cheers!

  2. Graham Swan
    Member
    Posted 1 year ago #

    Ah, I figured it out!

    To do post-processing, you don't redirect the form submission to your own file.

    You simply modify the my_cforms_ajax_filter($params) function in the my-functions.php file (in your cForms directory).

    This function is executed after form validation and before any data processing takes place (so you can intercept the form data).

  3. Mark
    Member
    Posted 1 year ago #

    Just what I was looking for!

    Would you mind just specifying the modifications that need to be made to the function to enable submission to an external database, please?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags