Wiki

New Case Case Status
Log In

Wiki

 
Accessing Incoming Parameters
  • RSS Feed

Last modified on 8/6/2009 1:59 PM by User.

Tags:

Accessing Incoming Parameters

FormComposer has access to a variable within all pieces of content that allows the user to access the incoming information.  For example:

{% case param.source %} 

   {% when 'austin' %} 

        Welcome Austin Homeowners! 

    {% when 'houston' %} 

       Houston HomeOwners Contact Us At 1-800-555-5555 

   {% else %} 

       Welcome! {{ param.source }}

{% endcase %}


The above is a simple case statement, one of the advanced syntax features of Liquid markup. In this context the user has access to the “param” object inside the markup and can reference the incoming “source” parameter and ask about its contents. Based on that you can then make any number of decisions or branches as you need. The above can also be written using simple if constructs though with a tad less flexibility:

{% if param.source == 'austin' %}

   Welcome Austin Homeowners!

{% endif %}

{% if param.source == 'houston' %}

   Houston HomeOwners Contact Us At 1-800-555-5555

{% endif %}


so there are a couple of ways to implement this.  Params information can be important on a number of levels.  If the form you are introducing requires special functionality based on incoming data from the referring site then this should provide that functionality.

Prepopulating fields 

Along with the ability to access incoming parameters, most of the field types also have the ability to accept incoming parameters in order to pre-populate a form.  This an important feature since pre-populating data can also help with submission rates.  The field population is automatic and each field looks at incoming params of the same name in order to populate itself.  For example, if you have the URL

http://www.test.com/testpage?firstname=Test&lastname=User

Then the textfields for First Name and Last Name will automatically be populated with 'Test' and 'User', respectively.  This currently works for any simple textfield input, dropdown inputs, and hidden fields.