Close pop up form and land on a different page URL?

  • mysizeclothes
    Asked on November 18, 2015 at 12:37 PM

    Hi, i tried this with the bigCommerce, but i am not able to land on the Parent page.

    I crerated a page with the script but it just displays the title only instead of redirect.

    Do i have to add the childClosed() ? where should I add this .

    -thx

  • Charlie
    Replied on November 18, 2015 at 12:42 PM

    Could you please provide us more details on how your form is setup?

    What embed code you are using and how does your process flow works? You could also share us the website to where your form is embedded so that we can better check it.

    We'll wait for your response.

  • mysizeclothes
    Replied on November 18, 2015 at 2:13 PM

    hi thx for the response.

    Form is using the popup format of the jotform. from the product page.

    website is 

    http://mysizeclothes.com/lana-leather-jacket/  

    in the Descrition section  MC-Jacket Form

    I added <body onDISABLEDload="javascriptDISABLED:window.opener.childClosed();window.close();"> in  a page and liniked with thankyou page.

    When I hit the submit , it takes me that page. But I wanted the page to be closed and bring back to my products page.  This way it works nice in a mobile phones. Otherwise the back options does not work as intended in mobile. ( iPhone)

    -thx

  • BJoanna
    Replied on November 18, 2015 at 4:07 PM

    Thank you for providing us additional information. 

    Yes, you should use that code. You have to create another webpage on your webserver and use that as the Custom URL "Thank You" page for your form.

    In that new webpage you need to have this line of code:

    <body onDISABLEDload="javascriptDISABLED:window.opener.childClosed();window.close();">

    I have submitted your form and I got redirected to your custom Thank you page. After that I have inspected that page, but I did not find mentioned code.

    Where did you added this code?

    Looking forward to your reply.

  • mysizeclothes
    Replied on November 19, 2015 at 7:43 AM

    I will try how to create that page in BC. i used their create page, but by lines did not stick.

    after i saved the lines are gone. 

     

  • Charlie
    Replied on November 19, 2015 at 9:03 AM

    Have you contacted BigCommerce to see if adding <script> codes inside the description part of the product listing is allowed? If you are adding scripts then it is being removed after you save the changes, then it is possible that it cannot be added there.

  • mysizeclothes
    Replied on November 20, 2015 at 10:14 AM

    hi i managed to create a page with the specified body

    I have some BC specific head but body looks as it is mentioned.

    can you take a look at it. It is still not closing the popup.

     

  • Charlie
    Replied on November 20, 2015 at 11:11 AM

    Could you confirm what you would like to accomplish? If I understand you correct, you want to redirect the user to a different page WHEN the pop-up form is submitted?

    Here's a test page that I made: https://shots.jotform.com/charlie/parent_page.html. See if that's how you want it to work.

    Now this is how I setup mine:

    1. First, I will setup my redirect page. This is my redirect page: https://shots.jotform.com/charlie/redirect_to_parent.html. You can check the page source to see how my code is setup.

    2. First, I will add this script on my <body> tag.

    <body onDISABLEDload="setTimeout(redirectParent, 2000)">

    In that, I'm telling my page that it should run the function redirectParent after 2 seconds.

     

    This is how my redirectParent function is coded:

     <script>

            function redirectParent() {

                window.opener.location.href = 'http://www.google.com';

                self.close();

        }

      </script>

    My function says that I will redirect the parent window to www.google.com. After that, close the pop-up window. 

     

    3. Now I add the redirect page to my form's thank you URL.

    Close pop up form and land on a different page URL? Image 1 Screenshot 20

    See if my test pages works are you expected.

  • mysizeclothes
    Replied on November 20, 2015 at 11:23 AM

    Thx. I tried to close the Form after submit is pressed.

    so that the user will be  back in my product page. Popup the form and after the submit close the popup.

     

  • BJoanna
    Replied on November 20, 2015 at 11:43 AM

    I am not sure if your problem is resolved. 

    I tested example of my colleague Charlie and pop up form is closed after submission. Instead of http://www.google.com you need to redirect your users to your products page. 

    Let us know if you need further assistance. 

  • mysizeclothes
    Replied on November 20, 2015 at 11:53 AM

    The issue is the www.google.com in my case is dynamic. It depends on where the user is using the pop-up form.

    they can use from any product page..

     

  • Charlie
    Replied on November 20, 2015 at 12:02 PM

    When you say dynamic, you just want to close the window and just open the parent window?

    Example:

    1. User opened this link http://mysizeclothes.com/lana-leather-jacket/ 

    2. He clicks the MC-Jacket Form.

    3. Pop-up window opens

    4. User fills out the pop-up form.

    5. Pop-up form closes automatically.

    6. In the parent page SHOULD it still be http://mysizeclothes.com/lana-leather-jacket/? Or is he redirected on a different page?

     

    Please do elaborate. If you just want to close the pop-up, and remain on the same parent page, then you can remove the line highlighted in blue below on my script code:

    <script>

            function redirectParent() {

                window.opener.location.href = 'http://www.google.com' rel="nofollow";

                self.close();

        }

      </script>

     

    I've updated my code, you can test my website page again.

  • mysizeclothes
    Replied on November 20, 2015 at 2:19 PM

    Ok. Yes i just wanted to remain on the same parent page.

    I will try.

    thx

  • BJoanna
    Replied on November 20, 2015 at 2:33 PM

    On behalf of my colleague, you are welcome.

    Please let us know if were able to accomplish what you wanted.