What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to pass dates from one form to another?

    Asked by redam  on April 10, 2015 at 01:52 PM

    Hello JotFormers,

    i want to build a simple room reservation-system for my WP-Page.

    Therefore i made a check in/check out-Calender form (Form 1) and a second form (Form 2) for filling out name/adress to finish the reservation. 

    Users should pick the dates at Form 1 and by klicking "Send" be linked to Form 2 where the choosen dates from Form 1 should be displayed and ater filling out the rest of the form fields registration will be finished.

    Is this possible?
    Would be awesome if you can you help! THX!

     

     

     

    send data transfer value pass date
  • Profile Image

    Answered by Ben on April 10, 2015 at 03:11 PM

    If I understood you correctly, you would just like to send the data from one form to the other - this would be possible and quite easy to do with JotForm :)

    The only complication that can happen is if you wish to send the data to the other form, but have that form also embedded to your WordPress website. It would still be possible to do it, but it would not be as simple as few clicks.

    Do let us know the link to the page with first form and the details about the second one and we would be happy to assist with this.

  • Profile Image

    Answered by designfrontal on April 11, 2015 at 07:28 AM

    Hi Ben,

     

    thx for your feedback. :)

     

    actually i’m just building and testing my Wordpress-Theme on a virtual server (MAMP localhost), so i can’t send you an URL. The finished site will be hosted later under commercial domain (not hosted by wordpress.com)

     

    So, these are the two forms which i want to include via the jotform „<script>“-link.

     

    Form 1 (Choose Check in/out date)

    http://form.jotformeu.com/form/50995484678375

     

    Form 1 (Reservation form)

    http://form.jotformeu.com/form/50994075075361

     

    So visitors should be able to choose dates in Form 1 (embedded via script-tag on the Start-Page).

    By clicking on „Send request“ visitors shuuld be linked to a second page included Form 2.

    In Form 2 the choosen dates from Form 1 should be shown.

    If it’s possible visible in the calender -field or as normal text („Your Check in date: …… / Your check out date:…..)

     

    Hope you can help.

     

    Thx a lot.

     

  • Profile Image
    JotForm Support

    Answered by EltonCris on April 11, 2015 at 12:14 PM

    @designfrontal 

    Thanks for your reply.

    Here's how to pass date value from one form to another via URL parameter.

    1. First, I would suggest to use a regular textbox in your 2nd form as the recipient of the value. Or you can use calendars in lite mode (single field) because it is easy to fill a single text field rather than a group of fields (e.g. default calendar with 3 fields). To set your your calendar field into lite mode, right click it > show properties and set Lite Mode to Yes.

     

    2. Next, copy the field tags on the calendar fields from your first form. These are the values that will be passed to the 2nd form. 

    To get the field tags of a field, simply right click the field > show properties then copy the tag (wrapped with curly braces) under field details. Example:

    3. Use this app to prepopulate data on your 2nd form: http://prepopulate.jotform.io/. Just browse your 2nd form, fill in sample values of the recipient fields and generate the URL. Copy the URL and paste it to notepad or any other text editing tools you may have. After that, replace the sample values you filled in to that form with the field tags you copied from the first step.

    Example:

    http://form.jotformeu.com/form/50994075075361?datefield1={date1}&datefield2={date2}

    4. Lastly, set the modified URL as a custom thank you URL in your first form.

    Test your form afterwards by making an actual submissions.

    If you have difficulties understanding with any of the steps above or if you need further help, let us know.

    Thanks!

  • Profile Image
    JotForm Support

    Answered by EltonCris on April 11, 2015 at 12:27 PM

    @designfrontal

    Sorry, it seems not possible to populate a lite mode calendar as of the moment. I have already raised this as a feature request to our developers. For now, I would suggest to use a regular text box field in your 2nd form as the recipient of the value from the 1st form.

    Thanks!

  • Profile Image

    Answered by designfrontal on April 11, 2015 at 04:50 PM

    Wow, thanx for your detailed response.

    Unfortunately it seems i'm having serious problems with step 3 to 4.
    So, i managed to replace the two empty textfield in form 2 („Your Check in date: …… / Your check out date:…..) with value-fields of form 1 and generate the url via the prepulate-app.

    this is the code i entered in the textfield:
    [month]={anreisetag}-[day]={anreisetag}-[year]={anreisetag}

    The custom URL direction works fine, but in the textfield now there is only showing up the form code i defined, not the choosen values (form 1). So. i'm afraid the values aren't send to the 2nd form.
    See attached screenshot

    Would be awesome if you can help again!




     

     

     

     

  • Profile Image

    Answered by raul on April 11, 2015 at 08:20 PM

    I've checked your form and saw that the redirection URL had encoded characters.

    I've fixed this for you. Could you please try again and let us know if the fields are populated correctly now?

  • Profile Image

    Answered by designfrontal on April 12, 2015 at 08:02 AM

    Hello Raul,

    the encoded characters...thx for the hint!
    So, now the fields are populated correctly...cool!

    But i have two last questions:

    1. EltonCris mentioned before, that it's not possible to populate a lite mode calender.
    But is it possible with a normal calendar??Because it would be a nice feature if visitors also are able to change the check in / check out dates later in Form 2.

    But the most important question/issue

    Form 2 will be included/embedded in a subpage, not the same page as Form 1. So, by sending the "request"-button on Form1 users should be redirected to the 2nd page (main reservation), which includes Form 2.

    Therefore in Form 1  i set the redirect-URL to the wordpress-page (Permalink).
    In the redirected page i included the populated form-adress via script-tag.
    But it seems now the dates aren't passed to form 2...only the characters"{anreisetag}" are visible in the textfield.

    Is there any possibility to send the data from Form 1 to 2 and redirect to the page-URL at the same time??

    Hope you can help again!
    thx so much

     

  • Profile Image

    Answered by raul on April 12, 2015 at 10:41 AM

    1. EltonCris mentioned before, that it's not possible to populate a lite mode calender.
    But is it possible with a normal calendar??Because it would be a nice feature if visitors also are able to change the check in / check out dates later in Form 2.

    What my colleague meant was that you need to disable the Lite Mode in the calendar field in order to make the prepopulated URL work.

    Form 2 will be included/embedded in a subpage, not the same page as Form 1. So, by sending the "request"-button on Form1 users should be redirected to the 2nd page (main reservation), which includes Form 2.

    If the form is embedded then you'll need to use the iframe code so you can use the prepopulated URL as its src. But, you will need to POST the submitted data to the page where the form is embedded and use a PHP script to dynamically generate the URL of the iframe. Please refer to this guide: https://www.jotform.com/help/51-how-to-post-submission-data-to-thank-you-page and check the answer provided by @EltonCris on this thread: https://www.jotform.com/answers/12353#199613 

     

  • Profile Image

    Answered by designfrontal on April 12, 2015 at 12:03 PM

    thx again!
    i think we are almost there, but i don't get it to work.

    i managed to get the post data values (see attached screen)
    but where should i put the php-code lines and which lines?
    (i don't see a solution in EltonChris's answer)

    status quo:
    Form 1 seems sending post data (cause there now is short message "please whait while redirecting")
    but in the redirected page-url (a single wordpress-page including Form2 embedded via iframe) the data is not showing up.

    Form 2 is embedded as populated link-URL

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformeu.com/form/50994075075361?geplanteAnreise16={anreisetag}&geplanteAbreise17={abreisetag}" frameborder="0" style="width:100%; height:1137px; border:none;" scrolling="no"></iframe>.....

    So, i suggest there have to be put some postdata php-code in this URL?
    But don't know how and not very familiar with any coding.

    hope we get it to work! thx so much






  • Profile Image
    JotForm Support

    Answered by EltonCris on April 12, 2015 at 04:52 PM

    If your WP supports php scripts on post or pages, you can embed this code directly on your WP post/page.

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformeu.com/form/50994075075361?geplanteAnreise16=<?php $_POST['anreisetag'][0].'-'.$_POST['anreisetag'][1].'-'.$_POST['anreisetag'][2]?>&geplanteAbreise17=<?php $_POST['abreisetag'][0].'-'.$_POST['anbeisetag'][1].'-'.$_POST['anbeisetag'][2]?>" frameborder="0" style="width:100%; height:1137px; border:none;" scrolling="no"></iframe>

    If not, then install Insert PHP Plugin

    Then on the code above, replace <?php with [insert_php] and ?> with the end tag [/insert_php]. So the code becomes,

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformeu.com/form/50994075075361?geplanteAnreise16=[insert_php] $_POST['anreisetag'][0].'-'.$_POST['anreisetag'][1].'-'.$_POST['anreisetag'][2][/insert_php]&geplanteAbreise17=[insert_php] $_POST['abreisetag'][0].'-'.$_POST['anbeisetag'][1].'-'.$_POST['anbeisetag'][2] [/insert_php]" frameborder="0" style="width:100%; height:1137px; border:none;" scrolling="no"></iframe>

    If you need further help with this, let us know. Thank you!

  • Profile Image

    Answered by designfrontal on April 13, 2015 at 05:39 AM

    Hello EltonChris,

    thank you.
    Oooh, it sounded so good to me.
    Well, i installed the WP-Plugin and replaced the iframe-code as mentioned.
    BUT sadly after testing nothing showing up in the form-fields :(

    Any idea?
    Which information can i send you, for troubleshooting?

  • Profile Image

    Answered by Ben on April 13, 2015 at 09:08 AM

    Hi,

    I would actually suggest a different approach than the one above, since it should be much simpler for you to implement and easier to maintain.

    Please make the following changes:

    1. No send to POST (not needed) so we should set it to disabled
    2. change the thank you page to send the variables to the second page
    3. change the php code to capture the GET variables instead of POST
    4. transfer this data to form and voila ;)

    I know that it might seem as a lot of work, but it is actually quite simple so lets go through the steps above:

    1st step - No send to  POST

    Open your form to edit it and click on Preferences -> Advanced Settings -> Send Post Data = No

    Made the change? Great, that is all for step one ;)

    2nd step - altering the thank you page

    This one is almost as simple as the one above it, let us see what exactly we need to do.

    Feel free to change the field on the second form to a date field and we will help you set it up afterwards, for now, I will use the fields currently on form.

    So this would be a link to direct form:

    http://form.jotformeu.com/form/50994075075361?geplanteAnreise16={anreisetag:month}-{anreisetag:day}-{anreisetag:year}&geplanteAbreise17={anreisetag:month}-{anreisetag:day}-{anreisetag:year}

    Now all you need to do is to replace the bold part with your localhost during testing or the website once in production.

    For example, if your localhost folder is named wordpress and the page where the form is at is named form, this would be the link to it:

    http://localhost/wordpress/form?geplanteAnreise16={anreisetag:month}-{anreisetag:day}-{anreisetag:year}&geplanteAbreise17={anreisetag:month}-{anreisetag:day}-{anreisetag:year}

    Now we place that in the Thank you page on first form, so that it takes us to that second page with the right values.

    You can see how to add it by following the steps here: Redirecting Users to a Different Page

    - That is it - you are practically finished :) All that is left now is to copy paste the code from the rest of the steps and to test it all out ;)

    3rd step - Change the PHP code

    OK, so I would suggest adding this code to your page - at any point that you can - that accepts PHP code.

    <?php
        $jotformparameters = ''; //this is a default value for us :)
        if( isset($_GET, $_GET['geplanteAnreise16'], $_GET['geplanteAbreise17']) )
        {
           $jotformparameters = '?geplanteAnreise16=' . $_GET['geplanteAnreise16'] . '&geplanteAnreise17=' . $_GET['geplanteAnreise17'];
        }
    ?>

    Then on the form embedding code, we just add this (at the end of the link):

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformeu.com/form/50994075075361<?php echo $jotformparameters; ?>" frameborder="0" style="width:100%; height:1137px; border:none;" scrolling="no"></iframe>

    Basically if you open the page without the date, you will not get the error with this code, and if you pass the date to it properly, it will get added to the form directly :)

    Do make a test and let us know how it goes :)

    Just to note, wordpress is not very keep on running PHP code from within the post, and it would instead, just print it out to the page, so this must be added to the php code directly.

    Do let us know how it goes.

  • Profile Image

    Answered by designfrontal on April 13, 2015 at 10:41 AM

    Hi Ben,
    woop, seems an endless issue, sorry!
    So now it's working....but only 50%!

    First try i get a 404-error code on form 2.
    But i found out, that i have change the php-tags because of the (Insert PHP) WP-plugin.
    So, it's working correctly now, but it seems that only the "check in"-Date is showing up in Form 2.
    (see screenshot attached) 

    You mentioned that the date values also can be send from calendar to calendar.
    Maybe this is a better way / should we try this?

    That's how Form 2 is embedded at the moment.

    -----
    [insert_php]

        $jotformparameters = ''; //this is a default value for us :)

        if( isset($_GET, $_GET['geplanteAnreise16'], $_GET['geplanteAbreise17']) )

        {

           $jotformparameters = '?geplanteAnreise16=' . $_GET['geplanteAnreise16'] . '&geplanteAbreise17=' . $_GET['geplanteAbreise17'];

        }

    [/insert_php]

     -----

    Don't know why the check out-value (geplanteAbreise) is not transfered.
    any idea?
    Maybe you have a working model, where i only have to chance the page URL?


  • Profile Image

    Answered by Ben on April 13, 2015 at 11:58 AM

    Do try to see if it gets filled out when you access the form directly for you - since it works for me:

    http://form.jotformeu.com/form/50994075075361?geplanteAnreise16={anreisetag:month}-{anreisetag:day}-{anreisetag:year}&geplanteAbreise17={anreisetag:month}-{anreisetag:day}-{anreisetag:year}

    Now in regards to the date field, yes, lets do that :) Do add it to your form (but make it out of 3 segments - standard field, not the simplistic/minimal one).

    Once you do do let us know and we will be happy to set it up :)

    Now in regards to the PHP, yes, you are correct, I did not notice that you had used the WP Plugin for that and gave you pure PHP code, but I am glad that you found a way around it.

    I would only like to confirm, that - per your response - it is now working and when you go from one page to another, data is sent to your other form?

    Do let us know once you add the date field(s) to the second form and we will help you with the correct data to be passed over as well.

    One more thing. Even if it is on your local host, if the value does not get passed to the field, please copy the link so that we can see if there is any reason why it did not get passed over.

  • Profile Image

    Answered by designfrontal on April 13, 2015 at 01:44 PM

    No big deal, but there is a little mistake in your URL, cause the values of the second field have to be Abreisetag (not Anreisetag) 

    So, the correct and used link is:

    http://form.jotformeu.com/form/50994075075361?geplanteAnreise16={anreisetag:month}-{anreisetag:day}-{anreisetag:year}&geplanteAbreise17={abreisetag:month}-{abreisetag:day}-{abreisetag:year}

    But i finally found out why the second field didn't get the dates from Form1 since now:
    Don’t know why, but in the embedded php code there was a Uppercase mistake

    before (not working): . $_GET['geplanteabreise17'];

    now (working!):  . $_GET['geplanteAbreise17'];

    crazy...i didn't thought about that!
    But hey...we are finally here and the data is send now correctly. :)
    THX so much!!

    Because you offered help:

    I now also added calendar date fields (standard mode) to the 2nd form

    http://form.jotformeu.com/form/50994075075361

    Maybe we can get this also to work!? 

     

  • Profile Image
  • Profile Image

    Answered by designfrontal on April 14, 2015 at 10:55 AM

    Hello raul,

    Yes, it works! :)

    Final question:
    What would be the URL, if i use standard calendar mode in Form 1?
    It seems the code above only works for the lite-mode calendar in Form1.

    Maybe just in case i want to switch from lite to standard, so on both forms are the same calendar modes it would be perfect to have both working redirection URLs.

    btw. really awesome support-Team in this forum!
    greetz

  • Profile Image

    Answered by Ben on April 14, 2015 at 12:15 PM

    I am glad to hear that it is working now for you :)

    Now in regards to the link, it seems to work just nicely with the single and when the date is in 3 different fields (on second form):

    http://form.jotformeu.com/form/50994075075361?geplanteAnreise[month]={anreisetag:month}&geplanteAnreise[day]={anreisetag:day}&geplanteAnreise[year]={anreisetag:year}&geplanteAbreise[month]={abreisetag:month}&geplanteAbreise[day]={abreisetag:day}&geplanteAbreise[year]={abreisetag:year}

    The same code would and should however need to work even if you change it to standard mode.

    If you create a different field however it will have a different tag / name so you must alter the link to accommodate this.

    Do let us know if you will be using this form: http://form.jotformeu.com/form/50995484678375 with such field (in the future) and do test to see if it is working or not. If not, do leave it in standard mode and we will check it out for you.

    btw. really awesome support-Team in this forum!

    In my colleagues' names - thank you :)

  • Profile Image

    Answered by designfrontal on April 14, 2015 at 03:08 PM

    Hi!

    ah, i tested the standard mode with a alternative extra Form 1 (ready styled for the WP-Page).
    http://form.jotformeu.com/form/51023301141331
    So it seems this one have different tags, as you mentioned?

    If you don't mind, maybe could you get me the URL with the right tags for this one too?
    And than we are finally done! :))

    The original Form 1 now worx fine in classic mode...cool!
    http://form.jotformeu.com/form/50995484678375 

    THX!

  • Profile Image

    Answered by Ben on April 14, 2015 at 04:24 PM

    So it seems this one have different tags, as you mentioned?

    Yes, you should take it that they always have different tags, but you can always define them yourself, by double clicking on the {tagname} under properties window.

    You can see more about how to find the name here: How to find Field IDs & Names

    At this time the fields above will be linking to your second form properly if you add this link in the thank you page redirect field:

    http://form.jotformeu.com/form/50994075075361?geplanteAnreise[month]={anreise3:month}&geplanteAnreise[day]={anreise3:day}&geplanteAnreise[year]={anreise3:year}&geplanteAbreise[month]={abreise:month}&geplanteAbreise[day]={abreise:day}&geplanteAbreise[year]={abreise:year}

    Do let us know how it goes :)

  • Profile Image

    Answered by designfrontal on April 14, 2015 at 04:54 PM

    Hey Ben,
    just want to inform you that now all is going well and the form is working correctly.

    thx again for your support!

  • Profile Image

    Answered by raul on April 14, 2015 at 05:40 PM

    You're most welcome.
    We're glad to see that your forms are working as expected now.

    Feel free to contact us anytime, should you require our help.
    Best Regards.