On this page:
...
- Default values entered when the form was created in the Form Designer
- Values from an XML document(s) sent in the Post request for the form or OnInit.
- URL parameters appended to the form URL via the _data URL parameter
- Values retrieved as the form loads from any Document URIs
- And finally default Default values set via Business Rules as the form loads and during use. See Setting default values in rules and using REST Services in Rules for further details.
...
Expand | ||||
---|---|---|---|---|
| ||||
If you are appending parameters to a URL, use the a ? for for separating the form/workflow URL from the parameters and use the & to separate parameters from each other. For example, let's say you want to append the Pacific timezone parameter to the share URL of your form/workflow. Here is an example using the Link(Email/Web page) URL for a workflow: Add ?_formTz=America/Los_Angeles to the URL. Use the ? since there are no existing parameters appended.
Here is an example using the Raw Workflow URL for the same workflow: Add &_formTz=America/Los_Angeles after the last existing paremeterparameter. Use the & since you are separating parameters from each other.
|
Form fields can be initialized directly from the form's HTTP URL. You can do this by using the special (reserverdreserved) URL parameter called _data. Below is an example of a form initialized via _data. The syntax for _data is based on Rison. This form was initialized by appending the following to the URL from the form's Share Email/Web Page form link..
Code Block |
---|
?_data=(EMail2787:'joe@gmail.com',Name:'Joe',Desc:'Please send details',Q:'20') |
Note |
---|
While not mandatory in all cases it is highly recommended that you enclose the values in single quotes. Thus Name:Joe should be added to the URL instead as Name:'Joe'. Also, certain characters may need to be URL encoded. See quoting values below for details. Also note that the The only supported format for dates is the XSD schema date format; you must use YYYY-MM-DD. |
...
The form fields are addressed in the _data parameter by their Name property if the control was added from the palette and by the XSD element name if the control was added from data sources. In the example above the form has 4 controls. The control labeled Email Address has the name EMail2787. The controls labeled Full Name has the name 'Name'. Description is named Desc and Quantity is named Q. See the Form Designer below with the Quantity control selected and you can see that it's its name in the Properties Settings is 'Q'.
...
Tip |
---|
If you append the _data parameters to the form/workflow raw link or if you are using the Embedded form (script) to share your form the "?" does not work. Use the "&" character , instead of the "?" to append the _data parameters. |
...
One common use for _data is in the Form Action Post and the Go to Url, and in the Doc Action Post. You can use Templatized Strings to set the Url parameter values dynamically from the form field values. One example: imagine your form contains a field named 'custName'. &_data=(fname:'{custName}') sets the value of fname to the value in the form field named custName. The value in the form field custName is replace replaced when this _data is interpreted. If the post is to a form Url and that next form has a field named 'fname' that field will automatically be initialized to the value of 'custName'.
...
If you are using _data to pass values entered into form 1 to initialize fields in form 2 AND the fields in form 1 are not required (meaning when the form is submitted the fields may not contain values), you must quote the templates. For example, if Id is not a required field then this &_data=(customerId:{Id}) will fail when the field has no value. To prevent this failure always use quotes.
Note |
---|
Certain characters such as % need to be URL encoded. The w3schools.com website describes in detail the reason certain characters must be encoded when used in UrlsURLs. And it also contains a tool that lets you enter your string and converts it to a properly encoded string. For example if your value is '% complete' this must be written as '%25 complete'. The single and double quote characters themselves must be escaped with the escape character '!'. For example, the string 'Nancy's Horse' must be written as 'Nancy!'s Horse'. If the '!' is missing from the string the apostrophe will be mistaken as the end-of-string character. |
Repeat Controls
Initializing repeats requires a special syntax. :!(<value1>,<value2>,etc..!). In the current release Url Templates, variables are not supported for repeats.
- &_data=(A:!(one,two!)) expects to find two controls named A (a repeat) and sets them to one and two.
If _data contains more instance instances of the repeating item then than on the form by default, then it will create new items as the form is loading, as if the user had clicked the "+" button.
This membership list form contain contains a single default empty member item. The controls First Name and Last Name are named fn and ln respectively.
...
Excerpt | ||||
---|---|---|---|---|
When you initialize controls with Date or Time values, they will always display the exact value passed. However, the Date/Time control is time zone dependent, and will behave differently depending on how the time zone is provided:
Here is an example of a URL that initializes a date only, time only, and date/time control. Notice that the Date/Time value does not have a 'Z' or other another timezone indicator, but the appended &_formTz parameter supplies the timezone, America/New York.
The local time will be converted to and saved in a valid UTC format for the time portion of the date/time control in the submission XML document. You may see the time in UTC format with a trailing "Z" (UTC) time or the time value plus or minus the UTC offset. See Initializing Forms with XML Documents and Viewing XML Documents for further information. |
Checkbox Controls
In the current release selecting multiple check box Selecting multiple checkbox options is not supported via _data. Also when using Url templates only the 1st item from the named template will be used.
Unbound Controls
Variables passed into your form via _data need not be bound to actual form fields. Since _data is used as a way to initialize form fields why would you want to do this?
One place this is very useful is in business rules. See the section on templatized URls in business rules for more details. However anywhere that you can use templates in your form: labels, help, hint; display message, etc... the value can either come from the value in an actual form field or from _data values that are not in any way bound to the name of a control.
...
The embedding page and must be in the the same domain/origin. Typically this means the same uri URI scheme, host, and port.
The value of onInit must be an in-scope javascript function. This onInit javascript function will be called before the form is instantiated. For example &onInit=getData will cause to call the getData() javascript function. The onSubmit function will be called after the submit button is clicked.
Here is a sample html HTML page an embedded script tag and an onInit javascript function. The script tag copied was from the Share dialog and the &onInit Url parameter was appended. Each xml XML document is placed inside a container element (input, textarea, or any other element such as a div) and assigned and xml an XML id. In this example there is a single xml XML document placed inside a <textarea> tag.
...
This is how the form looks when initialized via the onInit method. The particular form used in this sample has a repeat control. By default, this form has a single repeating item. When initializes the form with repeating data returned from the getData() method it auto creates the additional items. This form also contained a an Item Added Rule which is why there is also a value in the Quantity field.
...
If form A and form B both contain the same data source, and the Form Action in form A is set to '''Post'' ' to the form Url of form B, then form B's fields from schema will be initialized with the values entered into form 1.
This occurs because the Post request to the Form Server contains the XML document(s) from form A. If one data source was added from XSD schema to form A. Then it will contain two documents. The first is the form's from-scratch document containing elements for all controls added from the palette. The second is the schema document.
...