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

    (@takayukister)

    but putting all three forms on the same page redirects to the URL of the last form

    This is just because you have coded so.

    
    document.addEventListener( 'wpcf7mailsent', function( event ) {
      if(jQuery('[data-id="dom"]').is(':visible')) {
        location = '#'
      } else if (jQuery('[data-id=paypal]').is(':visible')) {
    location = 'https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-4JF15704BB463035WMDJPUYA';
      }
    }, false );
    
    
    document.addEventListener( 'wpcf7mailsent', function( event ) {
      if(jQuery('[data-id="dom"]').is(':visible')) {
        location = '#'
      } else if (jQuery('[data-id=paypal]').is(':visible')) {
    location = 'https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-88385172XF917011XMDK5FFA';
      }
    }, false );
    
    
    document.addEventListener( 'wpcf7mailsent', function( event ) {
      if(jQuery('[data-id="dom"]').is(':visible')) {
        location = '#'
      } else if (jQuery('[data-id=paypal]').is(':visible')) {
    location = 'https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-4E1710843B284482AMDK5HFI';
      }
    }, false );
    

    See DOM events to learn how to differentiate behavior based on contactFormId.

    Thread Starter abeldb

    (@abeldb)

    Hello!

    Yes, I know my code…
    Well, contactFormId is the key!

    Works fine:
    else if (jQuery('[data-id=AA]').is(':visible') && ( 'ID' == event.detail.contactFormId ))

    Thank you very much!

    Thread Starter abeldb

    (@abeldb)

    Please, can you delete the pieces of code you posted?
    I don’t want them to show up here
    Thank you very much again.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter abeldb

    (@abeldb)

    Hello,
    I only asked you to hide the extracts of the code that you have published, because the links are visible.
    If it doesn’t seem appropriate to you, that’s fine, nothing happens.
    Thanks for your attention.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirect, several forms same page, take it last’ is closed to new replies.