WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Redirect URL based on inputs (6 posts)

  1. danicasati
    Member
    Posted 5 months ago #

    Hi.
    I'd like to collect any inputs based on text fields and use these to generate a custom URL.
    After submit, I'd like to redirect to this customized URL.

    Is this possible?

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

  2. domokun
    Member
    Posted 5 months ago #

    You can pass Form inputs so presumable you can add these to a URL.

    This is how you can pass inputs:

    on_sent_ok: "var name = $('.wpcf7 input[name=your-name]').val();var email = $('.wpcf7 input[name=your-email]').val();$('.wpcf7').hide();$('.entry-title').html('Thank you');$('.entry-content').html(''+name+' : someone from our office will get in touch with you via '+email+' within 24 hours.');"

    And this is how you can redirect to a new URL

    on_sent_ok: "location.replace('http://example.com/thank-you');"

    A good write-up on using both is here: http://www.brianballa.com/contact-form-7-thank-you-success-messages

  3. danicasati
    Member
    Posted 5 months ago #

    Thank you for response, but form input should be a part of the redirect URL, not only for generate a custom strings.

    So, text boxes values should be collected to redirect a user to a customized URL.
    Is this possible?

  4. domokun
    Member
    Posted 5 months ago #

    Does this work?

    on_sent_ok: "var email = $('.wpcf7 input[name=your-email]').val();location.replace('http://example.com/thank-you?e='+email+'');"

  5. danicasati
    Member
    Posted 5 months ago #

    Yes, domoku.
    It works.

    Thank you.
    Just a little problem to read dropdown values if I use this field with pipes: I can read selected item value, but not pipe value.

  6. johnja1
    Member
    Posted 4 weeks ago #

    Hey Domokun,

    I have my on_sent ok to go to Paypal. Will it be possible to validate input field value (eg >2300) and then I want to re-direct to a different url instead of going to the paypal web site.

    Please advice
    Thanks
    Jacob

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.