• Hey everyone,

    I was wondering if you guys can help me with this.
    I have a cf7 form that I want to validate using the normal validation, but I don’t want the form to submit though ajax.

    I just want the normal form behaviour where the form redirects to another page.

    How can I do this with CF7?

    Thanks,
    Rik

    https://wordpress.org/plugins/contact-form-7/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter rikdegraaf

    (@rikdegraaf)

    I can disable javascript submitting. But then the validation does not work anymore.
    So now I either need to add custom validation, but I really like to use the validation available in Contact form 7.

    Anyone?

    So, if I understand you correctly, you want to use form’s built-in validation but also have the ability to redirect to another page after submit?

    In the Additional Settings tab I added this:
    on_sent_ok: "location = 'http://somewebpage.com/redirect-page';"

    The form will validate and submit (even with submit response will show) but then it will redirect to the page designated above.

    If you don’t want to see the response and redirect to a page regardless of successful submit or not, use:
    on_submit:

    Manual on page: http://contactform7.com/additional-settings/

    Thread Starter rikdegraaf

    (@rikdegraaf)

    I know the on_sent_ok, but what you are saying is that it also posts the entered values to that page?

    I am not good at coding, just good at bending something to work to my advantage to a certain point.

    My suggestion will not pass the variables to the next page. I suppose you can pass the variables in the URL but that’s something I do not know how to do (passing PHP variables to javascript URL). And, after testing for a bit it looks like Additional Settings perform well after form submission. Which means there’s nothing to post to the next page. I assume you already know that.

    ‘on_sent_ok: “location = ‘https://thankupage_url.com&’ + $(‘form.wpcf7-form’).serialize();”‘

    Above code is to make post data to URL query. Perhaps this might be of use for you. It is not mine, I found it in one of the posts but I cannot reference it now.

    Once they are in the query, you can use let’s say PHP to $_GET[‘var’] and use it that way.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Ajax validation, no submission’ is closed to new replies.