Jump to content


Welcome to the T3Leads Forum.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, create your account today.
To all the members who previously registered on the old T3Leads forum: your registration data were not transferred from the old forum. To get started on the new T3leads.com forum please register again to get access.

Photo

How to pass values by default?

Leads channels

  • Please log in to reply
No replies to this topic

#1 admin

admin

    Admin

  • Administrators
  • 38 posts

Posted 01 September 2013 - 01:16 PM

If the user has already provided some information into the form. For example, when you have a mini form on the main page of your website which the user completes and then proceeds to the main form. Or if the user is one of your existing clients and you've already captured their information. You can transfer the data to the main form to avoid duplicating the process.

Usage Examples:

  • During form installation, pass available values as JSON object
  • Pass the values by GET method
    • Retrieve the values from GET, form a JSON object from those values and pass the object to the form.
    • Automatic search of values in GET

List of variables that can be passed into different products forms is listed in documentation:
https://t3leads.com/documentations


1. Passing values by json object when loading the form
(Used when values are stored in the database)
List of variables : https://t3leads.com/documentations

var inputOptions = {
    'UserID': 'test',
    'Product': 'payday',
    // ...
    'DefaultValues' : {
        first_name: 'Anton',
        last_name:  'Panfilov',
        state:      'CA',
        zip:        '91023',
        email:      '[email protected]'
    }
};

2.1 Passing values by GET variables, manually
(Used when values are sent from a different form)
List of variables: https://t3leads.com/documentations

// function getting GET variable
function getParamForPrepop(n){
    a=window.location.toString();
    a="&"+a.substring(a.indexOf("?")+1);
    p=a.indexOf("&"+n+"=");
    a=p==-1?'':a.substring(p+n.length+2);
    v = a.indexOf("&")>=0?a.substring(0,a.indexOf("&")):a;
    return unescape(v);
}

var inputOptions = {
    'UserID': 'test',
    'Product': 'payday',
    // ...
    'DefaultValues' : {
        first_name: getParamForPrepop('FNAME'),
        last_name:  getParamForPrepop('LNAME'),
        state:      getParamForPrepop('STATE'),
        zip:        getParamForPrepop('ZIP'),
        email:      getParamForPrepop('EMAIL')
    }
};

2.2 Passing values by GET variables, automatic search of matching values
(Used when values are sent from a different form, GET variable names should match with variable names listed in specifications)
List of variables: https://t3leads.com/documentations

var inputOptions = {
    'UserID': 'test',
    // ...
    'AllowUrlParser': true
};

Example of passing values to the form with enabled automatic search of values in GET option:
 

http://domain.ltd/form.html?form[first_name]=Anton&form[last_name]=Panfilov

3. Passing values in PHP version code
Can be used in different cases.
For example, if default values are stored in database.

    $a = array(
        "method" => "php",
        "userid" => "test",
        "product" => "payday",
        "producttemplate" => "lights",
        // ...
        "defaultvalues" =>
            "{first_name: 'Anton', last_name:  'Panfilov', state: 'CA', zip: '91023', email: '[email protected]'}",
    );

You can also get the values from GET / POST variables

    $a = array(
        // ...
        "defaultvalues" =>
            "{first_name: '".$_GET["first_name"]."', last_name:  '".$_GET["last_name"]."'}",
    );






Also tagged with one or more of these keywords: Leads channels

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Copyright © 2017 T3 leads