Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

It may be useful to have a form pre-populate with certain data elements.  For example, you may want to default an Employee Name field for a human resources form to a specific Employee. One way to achieve this is to include the data in the URL link to the form.  If you are integrating access to forms into another line of business application like Salesforce.com, you can even pass application data in external URL's making this approach both useful and easy to implement.

To get started, you must know what query string parameters will be passed in the URL to the form.

Example Form URL
http://globalformsserver:3001/view/#!/form/5a6011602bbb480ba47056f1?firstname=John&lastname=Doe

The text after the question mark is referred to as the query string.  You can insert multiple parameters into the URL by joining them with the ampersand sign (&).

Use URL Safe Characters

It's critical to know that not just any character can be inserted into a URL. Any combination of letters and numbers is typically safe to use, but special characters of any kind should be carefully considered. If you need to use special characters as query parameters, they will likely need to be escaped (translated into an HTML friendly equivalent) or results can be undesirable.

The example above shows a parameters for firstname and lastname in the URL.  Since you may want to allow the user to override the value once the form displays, use a Custom Default Value rule on the component you want to load data into.  Access the Custom Default Value editor from the Data tab of a Component's settings.  A sample rule is provided below to insert the first name and last name provided in the URL into a single Text Component.

Set Text Component Value
var params = new URLSearchParams(window.location.hash.split('?')[1]);

if(params.get('firstname') && params.get('lastname'))
{
	value = params.get('firstname') + ' ' + params.get('lastname');
}


  • No labels