• johnja1

    (@johnja1)


    Hi there,

    In my form in the additional setting tab, I have put a code to check for input from the users and according redirect to either PayPal or to another site. Unfortunately in documentation, The method using on_sent_ok hook is no longer recommended. This function is scheduled to be abolished by the end of 2017.

    Can you please advice where I can put this code to evaluate the user input. This is very important as we need the form to work for our tournament.

    I realize that you mention to put the code in your theme’s template file and to use custom DOM events to run java scripts. I know a little bit of DOM but so good, But I’m not sure where to put the code. Please advice

    Code
    on_sent_ok: “if (document.getElementById(‘chessrating’).value> 2200) {location.replace(‘http://www.greensborochess.org/thank-you-for-your-participation&#8217;)} else if (document.getElementById(‘RegPay’).value== “Register & Pay Later”) {location.replace(‘http://www.greensborochess.org/thank-you-for-your-participation&#8217;)} else if (document.getElementById(‘RegPay’).value== “Register for 2200 rated & above” && document.getElementById(‘chessrating’).value< 2200) {location = ‘https://www.paypal.com/?cmd=_xclick&[email protected]&currency_code=USD&amount=’+jQuery(‘#Tournamount&#8217;).val()+’&return=http://www.greensborochess.org/thank-you-for-your-participation/&rm=2&cancel_return=http://www.greensborochess.org/cancellation-of-g-c-c-open-tournament/&item_name=GCC Open Tournament&email=’+jQuery(‘#email’).val()+’&first_name=’+jQuery(‘#fname’).val()+’&last_name=’+jQuery(‘#lname’).val()+’ ‘;} else {location = ‘https://www.paypal.com/?cmd=_xclick&[email protected]&currency_code=USD&amount=’+jQuery(‘#Tournamount&#8217;).val()+’&return=http://www.greensborochess.org/thank-you-for-your-participation/&rm=2&cancel_return=http://www.greensborochess.org/cancellation-of-g-c-c-open-tournament/&item_name=GCC Open Tournament&email=’+jQuery(‘#email’).val()+’&first_name=’+jQuery(‘#fname’).val()+’&last_name=’+jQuery(‘#lname’).val()+’ ‘;}”

    Many Thanks
    Jacob

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter johnja1

    (@johnja1)

    Hi Takayuki,

    Thank you for your reply. Just a few questions regarding the DOM events,
    a) Can I replace these code in the additional setting tab where I had put the code for the Hook on_sent_ok:?
    b) Will the additional setting tab be discontinued later?
    c) Where is the best place to validate inputs within our contact form ? please advice.

    Many Thanks
    Jacob

    Thread Starter johnja1

    (@johnja1)

    Hi Takayuki,

    Where can we put the DOM events code ? Please advice ? I’m not clear about you mentioning put in the Theme (header.php). can I put the in the form itself ?

    Thanks
    Jacob

    Thread Starter johnja1

    (@johnja1)

    Hi Takayuki,

    I’m still unable to use DOM events code as you recommended to reduce complexity I use the plugin Insert Headers and Footers to insert your code
    <script>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    location = ‘http://example.com/&#8217;;
    }, false );
    </script>
    Unfortunately it did not work. I use the default theme of WordPress http://www.greensborochess.org/test1/

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    I use the default theme of WordPress

    No. At least it’s not unmodified Twenty Fourteen.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Additional Setting’ is closed to new replies.