popup pro second popup not triggering

We've got 2 duplicate popups on the site but the second popup doesn't seem to trigger.
This was working a while back but I'm not sure if it was a recent upgrade that changed it or some other tweaks we may have made. And we have recently installed the wpmu dev dashboard.

How it should work is :
- Popup 1 is on all pages and pops up when the user clicks on a particular css. In this popup is a form which when submitted the parameter is added to the URL.
- Second popup is the same layout but always shows if there are particular parameters in the URL.

We set this up using approximate URLs based on a previous support ticket:
https://premium.wpmudev.org/forums/topic/is-there-a-way-to-trigger-the-popup-to-display-based

However at the moment is only seems to be showing the 1st popup as it only displays when clicking on the "Book a car" CSS selector.

  • Michelle Shull

    Hi there, John!

    So you're unsure when the issue started, but you think an update or some tweaks you did may be responsible? Can you fill me in on the updates/tweaks you made that you suspect here? This may help us track down why your second pop-up stopped firing. Have you reviewed the steps Adam gave you in the other thread, to make sure that second pop up is correctly set up?

    I'd like to try to test this on my own site, but I'll need a few more details here, as well. You mention that users are redirected depending on their answers in a form to a custom page? How is this set up to work? Does a plugin control this? Has that plugin been updated?

    Sorry for so many questions here, but we'll need all the details we can get to try to reproduce the issue you're seeing on our end, so we can determine what caused it.

    If you'd like to streamline this process a bit, I'd like to refer you to our Getting Support manual, which has some very simple, basic troubleshooting steps that may help you help us find what's gone wrong on your site. https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Thanks for your questions!

  • John

    You shouldn't need the plugin we're using to be able to duplicate the issue.

    If you go to http://babyprocar.com and click on the blue "Book a car " box in the top right it brings up the booking form popup.

    Go to http://babyprocar.com/?vehicles=1 and it should bring up a popup because of the approximate url match but nothing shows.

    I read the support page you referenced and I tried this with all no plugins and using the twentry 15 theme and the same issue shows up.

    The updates I mentioned upgrading from wordpress 4.2.1 to 4.2.2.
    We had both the free and pro versions of popup pro installed and didnt have the wpmu dashboard installed. I installed the dashboard and this seemed to break the site. So i uninstalled the free popup and updated the pro version. (another support call fixed the issue for me )
    But since then the 2nd popup doesnt seem to have worked.
    Our own plugin we're using may have been updated around this time but I get the same issue if we turn it off so don't think that's likely to be the issue?

  • Michelle Shull

    Hi John!

    I tried to reproduce what you're seeing as best I could on my own site.

    1. I created a popup that loads when a CSS element is clicked on the home page.
    2. I gave this button a call to action button that redirects the user to a new page.
    3. On that page, I set up a second pop up that shows on approx. URL, in my case what I entered was "/gallery"
    4. I tested by going to the home page, clicking the element, seeing the pop up, clicking the CTA button, then redirecting to the Gallery, where the second pop up appeared right away.

    If it's not working for you with all the other plugins deactivated and a custom theme, I suspect you entered a full URL for the approximate URL field, instead of just the bit after the trailing slash, like in Adam's example from your linked thread.

    In that approximate field, you'll enter "/?vehicles=1", not the full URL. Support access expired before we got back to you here, but I suspect this may be the issue. When I tested on my site by using the full URL, the second PopUp wouldn't fire for me.

    Hope this gets it!

  • Anang

    Hi @John

    I tested again your site and go to your homepage : http://babyprocar.com/ and click on "book a car" it's showing popup, and then go to http://babyprocar.com/?vehicles=1 it's showing popup to when loaded. Could you confirm this on your side ? I use google chrome

    The only problem I got is when on http://babyprocar.com/?vehicles=1 and click "book a car" it show me the first popup when page loaded not booking form, maybe because you include "not in url" option ?

    Let me know if you can replicate this on your side :slight_smile:

    Best Regards

  • John

    We changed the "form submit" field from "Redirect to form target URL" to "Refresh PopUp or do nothing (use for Ajax Forms)" and the disappearing popup issue disappeared.
    But it stopped input buttons from triggering their onclick events for some reason?

    Changed back to "Redirect to form target URL" and everything seemed to work again ok now, with the second popup disabled? I'm not sure why it's working though as without the second popup why is the original popup staying open in the response from the submit? It does what we want to do but we're concerned it'll stop again sometime.

    If we could get the "Refresh PopUp or do nothing (use for Ajax Forms)" to not break buttons that would be a better solution for us as customers then wouldnt need to wait for a page load each time.

  • Anang

    Hi @John

    If we could get the "Refresh PopUp or do nothing (use for Ajax Forms)" to not break buttons that would be a better solution for us as customers then wouldnt need to wait for a page load each time.

    It's because you choose "Refresh PopUp or do nothing (use for Ajax Forms)" so it's remove on click event in submit button. So you need to add javascript function to handle "onclick" event, to submit form via ajax and then close the form. Let me know if you want to try this solution :slight_smile:

    I see all popup is working now, what is the major issues with current flow ?

    Best Regards

  • John

    I had added an onclick to the buttons in the form but it wasn't having any affect for some reason.

    When I add the onclick manually from the chrome developer console it works. Is it a timing issue of when my jquery runs?

    Example of the jquery we include
    jQuery( document ).ready(function( $ ) {
    $('.snq_buttonp1').on('click', function(){
    window.location.href+= '?new_booking=1';
    });
    };

    When I run this from chrome manually and click the button it triggers this function.
    How do we readd the onclick method to the button without having to run manually?

  • Anang

    Hi @John

    Sorry for late response :slight_frown:

    After doing some testing, I'm able to execute javascript when I put jquery code in popup code editor.
    https://codex.wordpress.org/Using_Javascript . Here's my code that I put in code editor :

    <script type="text/javascript"><!--//--><![CDATA[//><!--
    jQuery("#click-me").click(function(e){
    console.log("button clicked");
    });
     //--><!]]></script>

    You can change it with your code, and test it if it's worked on submit or not :slight_smile:

    Let me know the result :slight_smile:

    Best Regards

  • Anang

    Hi John

    Did you need to escape the html characters to get javascript to work?

    No you don't need to escape the html, just put the javascript like code above.

    Not sure why but the popups are back to needing someone click the css selector to reveal the 2nd, 3rd etc steps of the form again.

    Could you give me access again to your Dashboard ? Any recently changes on popup settings or maybe installed a new plugin recently ?

    Looking forward for the access :slight_smile:

    Best Regards