When you open a form, you can add additional parameters to the URL of the form to prefill some form fields. You need to separate URL parameters from the main URL by adding a question mark ?. If you need multiple parameters, separate them with an ampersand &. This results the following pattern for the URL:

http://<host>//formcycle/form/alias/1/demo?<field1Name>=<field1Value>&<field2Name>=<field2Value>&...

Please note that when you need to use special characters, you need to escape them. For example, to specify an URL parameters named tfCompany with the value Clark & Joe Ltd.:

http://<host>//formcycle/form/alias/1/demo?tfCompany=Clark%20%26%20Joe%20Ltd.

Using URL parameters

You can use URL parameters to prefill form fields both when the form is opened for the first time as well as when a saved or submitted form is opened again. Please note that existing form field values are overwritten when URL parameters are used.

Examples

Prefilling an input field

Setup in the Xima® Formcycle Designer for prefilling an input field.

When opening the form, we set the URL parameter tfMail. This sets the initial value of the corresponding input field.

Create a input field with the name tfMail. When you open the form, add the URL parameter tfMail and set it to an email address. The URL could look like:

http://<host>/formcycle/form/alias/1/demo?tfMail=johndoe@example.com

As shown in the figure to the right, this sets the initial value of the input field to the given email address.

Prefilling a select field

Setup in the Xima® Formcycle Designer for prefilling a select field.

When opening the form, we set the URL parameter selSex. This sets the initial value of the corresponding select field.

You can preselect an option of a select field as well. Note that you cannot use the displayed name as the value of the URL parameter. You need to use the value specified in the values column of the options section in the properties panel of the Xima® Formcycle Designer.

Create a select field with the name selSex. When you open the form, add the URL parameter selSex and set it to f. The URL could look like:

http://<host>/formcycle/form/alias/1/demo?selSex=f

As shown in the figure to the right, this preselects the option female.

You cannot prefill repeated elements. It is also not possible to set the initial number of repetitions via URL parameters.

Changing the form layout

To open a form with a different layout (CSS theme), use the URL paramter xfc-rp-theme and pass the UUID of the CSS theme as the value. The UUID is shown in the details panel (1) to the right hand side of the Layout (CSS) menu.

You can create different form layouts (CSS themes) in the Layout (CSS) menu. You can then assign one form layout to each form. If you want to open a form with a different layout, such as a blue or red variation of your main theme, you can use an optional URL parameter.

The name of the URL parameter is xfc-rp-theme, and its value needs to be the UUID of the form layout. You can view the UUID of each form layout in the Layout (CSS) menu (see screenshot to the right).

For example:

http://<host>/formcycle/form/alias/1/demo?xfc-rp-theme=<UUID>
http://<host>/formcycle/form/alias/1/demo?xfc-rp-theme=8b4a9c2d-34d9-4cff-8759-9b54ed4b0ff1
Tags:
Copyright 2000-2022