Forums

Contact Form 7
[resolved] redirects based on radio button selection (5 posts)

  1. kremisoski
    Member
    Posted 1 year ago #

    I was wondering if there is a way to customize the submit button in a way that depending on which radio button is selected after the message sends it will send you to a different redirect.

    http://wordpress.org/extend/plugins/contact-form-7/

  2. kremisoski
    Member
    Posted 1 year ago #

    I tried this, and added it to header.php as well as added an additional parameter to the plugin settings. Unfortunately, it's working fine locally, but not online. Any suggestions?

    <script>
    function my_redirect() {
    var url;
    var radioButton = $('input[name=test]:checked', '#radio1').val();
    if ( radioButton == 'Facebook' ) {
    url = 'http://www.facebook.com';
    }
    else if ( radioButton == 'Twitter' ) {
    url = 'http://www.twitter.com';
    }
    else {
    url = 'http://www.youtube.com';
    }
    window.location = url;
    return false;
    }
    </script>

  3. kremisoski
    Member
    Posted 1 year ago #

    Sorry for the triple post, but I was mistaken. It works fine as long as the theme is well structured. I've tested it both online and locally with Twenty Eleven. :)

  4. miguelfromphil
    Member
    Posted 8 months ago #

    I was wondering if there is a way to customize the radio button of CF7?

    Now i am using separate contact form and radio button. Works fine, but my problem is some are missed to click "save"(CF7)(can't get their data.)and they jump into payment options(radio button)

    Below is my sample code. CF7 and re directional radio button ( or someone can help me, not continuing submit button once they not click on save button (cf7)

    </p>
    [contact-form-7 id="34" title="Sample"]</p>

    <p> Choose Your Payment Option</p>
    <p>
    <script type="text/javascript">
    //<![CDATA[function sub_win() { window.location.href = site; } function goTo(URL) { site = URL; }
    // ]]></script></p>

    <form name="frmSite">

    <input type="radio" name="site" onchange="if(this.checked){goTo('http://www.sample.com/ ')}" />sample</p>
    <input type="radio" name="site" onchange="if(this.checked){goTo('http://www.sample2.com/ ')}" />sample2</p>

    <input onclick="sub_win()" type="Button" value="Continue" />
    </form>

  5. EfremJ
    Member
    Posted 8 months ago #

    Hi, kremisoski.

    I just tried your method but am getting redirected to a URL on my site with /undefined appended to it.

    The URLs are valid. I don't get what I'm doing wrong. Any assistance would be greatly appreciated.

    -Efrem

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic