The field values are no longer being passed between the jotforms after switching to iFrames embedded code

  • daveoreardon
    Asked on September 27, 2014 at 4:33 AM

    Oh no! I can't use iFrames because it breaks my form logic.

    I have a single sign-up form (let's call if Form1) that uses a custom Thank You URL to run a PHP script (Script1) which then loads one of two other forms (Form2 or Form3), depending on a field value of Form1.

    Form1 passes several field values to Script1 via parameters in the URL. These fields are used both in the PHP script itself and in Form2 and Form3.

    The field values are no longer being passed between the forms with iFrames.

  • Ben
    Replied on September 27, 2014 at 6:24 AM

    Hi Dave.

    Can you please tell us if you have checked what values are passed from the jotform on your page when it is in iFrame?

    You can do that in your own files by looking at $_POST supper global.

    To see what was inside you can use something like the next code:

    <?php
    /* I would suggest this to be at the start of the file */
    $gotThis = var_export($_POST,true);

    $f = fopen('sent_from_form1.txt','w');
    fwrite($f, $gotThis);
    fclose($f);

    /* You can continue with your own PHP code from here. */

    Now, if it happens that the file it writes to got the right code, but that the other jotforms are not properly set, you can know that there is something with the php code.

    If it does not write anything, then the response has not been sent to it.

    You can also output the code to your browser, if you prefer changing the jotform to get some results visible to yourself right away.

    To do that just add this code to the redirection script:

    <?php
    /* I would suggest this to be at the start of the file */
    var_dump($_POST);
    /* You can continue with your own PHP code from here. */

    You can also just test it out by changing the link in your jotform to this URL http://www.jotform.com/show-post-data in order to see if the data is sent or not (you can read more here http://www.jotform.com/help/51-How-to-Post-Submission-Data-to-Thank-You-Page).

    I hope this gives you some answers or a way to go. Do let us know how it goes for you.

    Best Regards,
    Ben

  • daveoreardon
    Replied on September 28, 2014 at 7:41 AM

    Thanks Ben. For now, I've reversed out the iframe code so that my forms work again. It'll be Tuesday before I get a chance to follow your instructions. Will post back then. Cheers

  • Ben
    Replied on September 28, 2014 at 8:05 AM

    Hi Dave,

    Thank you for updating us, looking forward to your tests.

    Best Regards,
    Ben

  • daveoreardon
    Replied on September 29, 2014 at 1:51 AM

    Hi Ben

    Following your advice on my other thread, I've created two test html files:

    - http://www.test.ciopulse.com.au/test-jotform-iframe.html

    - http://www.test.ciopulse.com.au/test-jotform-simple.html

    The first uses the iframe method to load a simple Jofform (let's call it form1) that prompts for a payment method and a country. The second also loads form1 but via the non-iframe method.


    To remind you of the overall logic I am using:

    - Form1 uses a custom 'Thank You' URL to call a PHP script (let's call it script1) with these parameters: ?paymentMethod39={paymentMethod}&country={country}

    - Script1 then loads one of two identical looking Jotforms (let's call them form2 and form3), depending on the value of the country variable.


    The logic in script1 looks like this:

    $country = $_GET['country'];
    If ($country == "Australia")
    {Load form2 via the non-iframe method}
    else
    {Load form3 via the iframe method}

    The only reason I load form2 via the non-iframe method and form3 via the iframe method is to help us work out the problem. My preference would be to not use the iframe method at all (but still get the frame border shadow working correctly).

    Both form2 and form3 have a read-only field called 'country' and a hidden field called 'paymentmethod39'. Form2 and form3 use conditional logic to display certain fields depending on the value of the country and paymentmethod39 fields.


    I can confirm that the field values from form1 are being passed to script1 with both the iframe method and the non-iFrame method. Here's the result of the code you asked me to include in script1:

    iFrame
    =====

    array (
      'submission_id' => '287763087842642472',
      'formID' => '42617544191960',
      'ip' => '124.168.75.248',
      'paymentmethod' => 'One year in advance by invoice',
      'country' => 'Australia',
      'pleasedont24' => '',
    )


    No-iFrame
    =======

    array (
      'submission_id' => '287763226842392775',
      'formID' => '42617544191960',
      'ip' => '124.168.75.248',
      'paymentmethod' => 'One year in advance by invoice',
      'country' => 'Australia',
      'pleasedont24' => '',
    )


    What I've found is that the two fields are correctly passed from form1 to form2, but not from form1 to form3. This happens regardless of whether form1 is loaded via iframe or non-iframe, i.e the problem only occurs when form3 is loaded via iframe.

    You can see this for yourself by using either of the URLs at the top of this post, selecting 'one year in advance' as the payment method and picking either Australia or any other country. If you pick Australia, you will see form2 load (non-iframe) with the read-only country field correctly set to Australia. If you pick any other country in form1, you will see form3 load (iframe) with the read-only country field incorrectly blank.

    Note also - the border shadow looks perfect in test-jotform-iframe.html, but the bottom horizontal shadow is missing in test-jotform-simple.html. They both load the same form.

    Cheers Ben.
    Dave.

  • jedcadorna
    Replied on September 29, 2014 at 7:59 AM

    Hi Dave,

    After testing the URLs you provided you are correct about form1 doesn't send to form 3 but works fine when sending to form 2.

    Form 1 - http://www.jotformpro.com/form/42617544191960 
    Form 2 - http://www.jotformpro.com/form/42642992903966 
    Form 3 - http://www.jotformpro.com/form/42651405712953

    I would like to personally test this on my test server and give you update here. I would also discuss this with my colleague to see what's causing this issue not to pass the value. We'll inform you about our findings.

  • jedcadorna
    Replied on September 29, 2014 at 8:35 AM

    Hi Dave,

    I can't seem to find any issues just by looking at your Form 2 and Form 3 as they have both identical values. We'd like to ask the script that you have in signup-payment-information.php? so we can compare it with the fields you have in your form 2 and form 3.

    I have set this thread to private so you and the support team members will be the only one who can ready this thread.

  • daveoreardon
    Replied on September 29, 2014 at 8:58 AM

    Here you go:

    https://www.dropbox.com/s/jyxl052vmax1jek/signup-payment-information.php?dl=0

     

    (It's late here in Australia, so I'll be offline for 9 hours or so now. Thanks for looking into this for me - I really appreciate this fantastic level of support. Goodnight!)

  • Ben
    Replied on September 29, 2014 at 10:15 AM

    Hi Dave.

    Thank you for that. We will take a look at this and get back to you once we figure out what might be the problem.

    Best Regards,
    Ben

  • jedcadorna
    Replied on September 30, 2014 at 7:12 AM

    Hi Dave,

    Sorry for the late response. Can you please test the page here if values from FORM 1 - FORM 2 and FORM 1 to FORM 3 are being passed https://shots.jotform.com/jed/Jotformtest/post/noniframe.html. It is passing the values now from FORM 1 - FORM 3 based on my test.

    Here's my test

    The field values are no longer being passed between the jotforms after switching to iFrames embedded code Image 1 Screenshot 20

    If that is how you want the form to work you can copy the code here http://pastie.org/private/vcah7snonemgen0l5kyww.

  • daveoreardon
    Replied on September 30, 2014 at 7:43 AM

    Yes your code works fine, thanks. 

    I'm really sorry though, because your version doesn't solve my original problem, which was with border shadows (injected CSS) not working properly (http://www.jotform.com/answers/434624-Border-shadow-from-injected-CSS-not-displaying-correctly).

    Things got tricky because the recommended workaround to my border shadow problem was to use the iframe embed method. When I did this, the shadow problem was solved but it created a new problem with the field values not being passed from form1 to form2 and form3.

    With your solution, the field values are being passed correctly but the shadow problem is back.  This is exactly what I already have in production now - field values get passed correctly but the border shadow is not displaying correctly.

  • Ben
    Replied on October 8, 2014 at 2:25 PM

    Hi Dave,

    I just wanted to make sure what was the status of this?

    Now in case this is not resolved can you please tell us what values you would need to pass?

    This will pass all of them and should work, but do let me know how it goes.

    This is the link to the code: https://shots.jotform.com/ben/daveoreardon/daveoreardon.php.txt

    You should rename it from .txt to .php for obvious reasons :)

    Now, what I have changed was adding this function to it prepForURL($val).

    This function builds the query as an URL parameter list and should pass it to the iframe.

    <iframe id="JotFormIFrame" onDISABLEDload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformpro.com/form/42651405712953<?php echo $preped; ?>

    Do let us know how it goes.

    Best Regards,
    Ben

  • daveoreardon
    Replied on October 13, 2014 at 5:55 PM

    Hi Ben

    Thanks for following up and being persistent. I really appreciate it.  I've decided not to go the iframe route. Apart from the border shadows not displaying correctly with the non-iframe embed method (my original problem), the parameter passing works fine. I prefer not to use iframes because I have to update the code when the form design changes  + the scripts that my Jotforms are embedded in are quite complex and I just don't want to mess with them.

    Thank you.

    Dave.

  • Ashwin JotForm Support
    Replied on October 14, 2014 at 2:47 AM

    Hello Dave,

    On behalf of my colleague, you are welcome.

    Do get back to us if you have any questions.

    Thank you!