0

Does anyone know of a way to create a custom success message and post to the expression engine processing controller manually?

I'm using jQuery validator, and usually what I would do is something like this:

   submitHandler: function(form) {
    var data = $(form).serialize();
        $.post(
            '/system/expressionengine/templates/default_site/global.group/form.php',
            data),
        function(data){
                $('#contact-form').html('<div id="success">We’ll get back to you.</div>');

            }
        );
    }
 });

Unfortunately with the expression engine {exp:email:contact_form} tags it posts straight to a page and always redirects the user.

Does anyone know of a way to post or properly format the data so that handler will accept the post data and allow a seamless form submission experience?

1
  • I don't know how to do this in EE contact form, might be easy I just don't know. It's definitely something you can do in Solspace's FreeForm. Feature comparison: solspace.com/software/detail/freeform – AllInOne Aug 11 '14 at 18:00
0

Answering my own question, what you have to do is post to the site url, you cannot use a custom php handler without a lot of work. I found this out by looking where the {exp:email:contact_form} posts to. You also have to disable CSRF protection, or find a way to snag the XID from the return data. (I just disabled it because we're not doing anything that is data sensitive)

    submitHandler: function(form) {
            $.ajax({
                url: "/",
                type: "post",
                dataType: "html",           
                data: $('#contact_form').serialize(),
                error: function(jqXHR, textStatus, errorThrown)
                {

                },
                success: function(html, textStatus, jqXHR) 
                {


                }

            });

        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.