How to create a second submission based on another one

  • WSMC
    Asked on February 28, 2016 at 5:07 AM

    We have an event entry form for a motor sport event. The first question on the form is "are you double driving". After submission, if this question has been answered Yes then we need to automatically create a second submission swapping the driver's and passenger's details over.  Both submissions need then to go to a Google sheet. If the answer is No then no second submission must be made. Any ideas please? Thanks Regards Ben

  • Ashwin JotForm Support
    Replied on February 28, 2016 at 6:46 AM

    Hello WSMC,

    Let me try to understand your requirement correctly and then we will surely try to help you. Do you want to create a form with following workflow:

    #1. User will provide driver and passenger / second driver information.

    #2. If the user selects "Double driving" as "Yes" then form is submitted but you want to again display the same form but swap the values of  driver and passenger / second driver fields?

    #3. What happens when user selects "Double driving" as "No"? Form will be submitted and thank you message will be displayed. User will not be redirected to same form again.

    We will wait for your response.

    Thank you!

  • WSMC
    Replied on February 28, 2016 at 6:53 AM

    Hi, Yes that's what we need. The 2nd submission should be automatic with no more input from the customer. Thanks Regards Ben

  • Mike_G JotForm Support
    Replied on February 28, 2016 at 10:49 AM

    Let me just to clarify things more before proceeding. Here's what I understood, you only need one form involved in this operation and base in your initial post, you want to have two (2) submissions created in that form if "Double Driving" field is equal to"Yes" and submit button is clicked, is that correct?

    So, the first submission would contain the original input of the submitter of the form, where data from driver's information fields will remain on driver's information fields and the data from passenger's information fields will also remain on the passenger's information fields. On the other hand, the second submission would contain the data of driver information fields and passenger information fields being swapped. These submissions will then go to Google Spreadsheet.

    I would like to apologize, unfortunately, this would not be possible because of the following reasons.

    1. There is no way we can create conditions that would involve clicking the submit button. 

    Meaning, we cannot create a condition that says, "If the submit button is clicked and 'Double Driving' field is equal to 'Yes' then make another submission with Driver's information and Passenger information being swapped."

    2. When the Submit button is clicked it can only create one submission. There is no way we can produce another submission automatically.

    3. In your form, the question "Double Driving" goes first and not on the last part of the form. So this would mean if the submitter selects "Yes" in that field then we need to swap field values first hand even if there are no inputs yet on the driver's infomation fields and passenger information fields.

    4. Even if we put the "Double Driving" field on the last part of the form, we still cannot swap values of fields, but we can only update fields using conditions. 

    Say you have two fields: driver information field and passenger information field. Now, you have another field which is"Double Driving" field. If what you would like to happen would be created, you would want the driver's information field data be passed to passenger's information field and vice versa if "Double Driving is equal to "Yes". This would only result in both fields having the same value. It's either the value of driver's information field or the value of passenger's information field depending on which condition is prioritized.

     

  • WSMC
    Replied on February 28, 2016 at 11:09 AM

    Ok, Can it instead create another entry which we ask the customer to check and they then press submit? Thanks

     

  • Mike_G JotForm Support
    Replied on February 28, 2016 at 12:29 PM

    If I understand your question correctly, you want your user to make two submissions by clicking the submit button twice, is that correct? 

    To explain it further, first the submitters will fill up the form and if they select "Yes" in the "Double Driving" field and click the submit button(first submission) the form will reload having the data of the information for driver's fields and passenger's fields automatically swapped this time. The submitters will then review the form again before they submit it for the second time(second submission), is that correct?

    Yes, this can be possible.

    Here's a sample form: https://form.jotform.com/60583578564973

    Here's what you need to do:

    First, make a condition that when "Double Driving" is equal to "Yes" and form is submitted, then reload your form, instead of already showing the Thank-You page. 

    How to create a second submission based on another one Image 1 Screenshot 40

    Above you'll notice that I use the form link and created the condition, Change Thank-You Page.

    We then need to re-create that link to swap values of fields in the form on reload. We will do that with the help of this guide, Prepopulating-fields-to-your-JotForm-via-URL-parameters

    How to create a second submission based on another one Image 2 Screenshot 51

    Note: You can make the "Question Name" window appear by pressing Ctrl+Shift+I in you keyboard when you're on your form builder page. How-to-find-Field-IDs-Names

    As for the complete Thank-You page URL in my sample form, here it is: https://form.jotform.com/60583578564973?driverInformation={passenger4}&passenger4={driverInformation}

    Notice that I swapped the values of the fields when the values are being passed.

    Here's how it works:

    How to create a second submission based on another one Image 3 Screenshot 62

    I'm not sure if you want the "Double Driving" field appear on the form for the second submission. Please be reminded that we can also pass its value, however, it will just create a loop(reloading the form over and over after clicking submit button) and not reach the Thank-You page message if it remains to a value of "Yes". Let us know what would you like to happen for that field or if you have any other questions. Also, please feel free to get back to us if there are things in the instructions above that's unclear to you or if it is not really what you would like to happen.

    Thank you.

  • WSMC
    Replied on February 28, 2016 at 3:48 PM

    Hi, That's looks fine. If we made the question Yes / No / 2nd Driver and get the customer to select 2nd driver instead when they are filling in the 2nd entry. Thanks Regards Ben

  • WSMC
    Replied on February 28, 2016 at 3:59 PM

    I've just read your text again. If possible it would be best to leave the "Double Driving" field out of the 2nd submission but can it be added after the Submit button is pressed the 2nd time just to keep my Google sheet looking correct?

  • Mike_G JotForm Support
    Replied on February 28, 2016 at 5:46 PM

    I have edited my form (https://form.jotform.com/60583578564973) and added the option, "2nd Driver" for the "Double Driving" field.

    How to create a second submission based on another one Image 1 Screenshot 60

    Then, I have updated the Form URL(link) in the Thank you page and added a parameter for the "Double Driving" field making it select the "2nd Driver" automatically when the form reloaded after the first submission.

    I have added this:

     

    &doubleDriving=2nd%20Driver

    making this:

     https://form.jotform.com/60583578564973?driverInformation={passenger4}&passenger4={driverInformation}

    become like this:

    https://form.jotform.com/60583578564973?driverInformation={passenger4}&passenger4={driverInformation}&doubleDriving=2nd%20Driver

    But, of course, we don't need to show the "2nd Driver" option of the "Doulbe Driving" field when the form initially loads, so we will hide the option using CSS . In that way, also, we will avoid it being selected during the first submission.

    How to create a second submission based on another one Image 2 Screenshot 71

    Here's the CSS code I've added to my form: 

    #input_1_2, #label_input_1_2{

    display: none !important;

    }

    After that, we then need to make the field "Double Driving" hidden if the "2nd Driver" option is selected using conditions. This instance will only happen after the first submission because when the form loads initially, it will not show the "2nd Driver" option making it not available for selection as explained above. The "2nd Driver" option, however, will only be selected after the first submission because the value of "Double Driver" is being prepopulated with that answer through URL parameters that we also did earlier.

    How to create a second submission based on another one Image 3 Screenshot 82

    By the way, you also need to set the "Clear Hidden Field Values" property of the form to "Don't Clear" under Preferences->Advance Settings.

    How to create a second submission based on another one Image 4 Screenshot 93

    Here's how it works:

    How to create a second submission based on another one Image 5 Screenshot 104

  • WSMC
    Replied on February 29, 2016 at 1:55 AM

    Hi Mike, Thanks for that. I'll try and set it up later. Regards Ben

  • Ashwin JotForm Support
    Replied on February 29, 2016 at 3:19 AM

    Hello Ben,

    On behalf of my colleague, you are welcome.

    Do try out the solution explained by my colleague and get back to us if you have any questions.

    Thank you!