No results found. Try again with different words?

Search must be at least 3 characters.

    How To Automatically Submit a Hidden Form on Thank You page after Submission of One Form? (Get Parameters)

    Have you ever thought of implementing an application like this –

    • Accept user’s name and email address through one call-to-action
    • Redirect user to another page (Thank you page with another button with a new offer)
    • When the user clicks on this button, the user’s name and email submitted earlier is fetched and submitted through this button too.

    This is certainly possible using Convert Pro settings along with some JS code.

    Now, since we need to add JS code, it is important that we activate the Advanced Scripts addon. You’ll find this addon under Convert Pro Settings -> Addon -> Activate the Advanced Script addon as shown in the screenshot.

    Activate The Advanced Scripts Addon

    Let us now proceed creating the required call-to-actions and setting them up.

    1. Create a call-to-action and add the required fields in it. (We will add an email and name field)

    Create Call To Action With Required Fields

    2. Click on the button, open the Action section and choose the button action as “Submit and Go to URL“. You can enter the destination URL in the respective field.

    Set Button Action in Call To Action

    3. Since we want to pass the lead data through Get parameter, enable the “Pass through Get Parameter” option.

    Enable Get Parameter Option

    These steps above will make sure that the data you obtain through the form and submit using that particular button is passed as parameters in the destination URL.

    Now, let us proceed to our Thank you page or the second call-to-action settings.

    4. Create another call-to-action that will have 2 hidden fields on it and a button. These hidden fields won’t be seen in the front end.

    New Call To Action With Hidden Fields

    5. Now, we’ll be adding a JavaScript code for this second call-to-action.

    This should be added under the “After Call-to-action Open” option as shown in the screenshot below.

    Go to Panel -> Advanced JavaScript -> After Call-to-action Open

    Here is the code that you need to paste in the section as shown in the screenshot –

    var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
    sURLVariables = sPageURL.split('&'),
    sParameterName,
    i;for (i = 0; i < sURLVariables.length; i++) {
    sParameterName = sURLVariables[i].split('=');if (sParameterName[0] === sParam) {
    return sParameterName[1] === undefined ? true : sParameterName[1];
    }
    }
    ; var email = getUrlParameter('email');
    var name = getUrlParameter('textfield_5121');
    jQuery('#cp_hidden_input-1-196 input').val(email);
    jQuery('#cp_hidden_input-2-196 input').val(name);
    
    Note: Since this code was used in the example above, you will have to make some minor changes in the field IDs used above. Here are the changes you need to work on –
     
    -> The third last line – var name = getUrlParameter(‘textfield_5121’);
    Please replace the textfield_5121 with the URL parameter which will be attached in the thank you page URL.
     
    -> The second last line – jQuery(‘#cp_hidden_input-1-196 input’).val(email);
    Please replace the cp_hidden_input-1-196 with the first hidden field ID
     
    -> The last line – jQuery(‘#cp_hidden_input-2-196 input’).val(name);
     Please replace the cp_hidden_input-2-196 with the second hidden field ID
     
    Once this is set up correctly, the hidden fields will fetch the values from the URL parameters and the form will get submitted with the same lead data when the button is clicked.
     

    Note:
    1. In case you are using email marketing software to collect leads, please make sure you map the two hidden fields (second call-to-action in Convert Pro) with the respective custom fields in the email marketing software.
    2. Please use page level targeting options for the second call-to-action and enable it on only the destination page.
    3. Hide the first call-to-action on the destination page.
    Here is an article you can refer to in order to know more about page level targeting.
     

    Was this article helpful?

    Did not find a solution? We are here to help you succeed.

    Related Docs

    Compare Convert Pro with...

    29439
    29440
    Scroll to Top