Forms and workflows can be initialized by an XML document. This is most commonly done when the form is created from an XSD data source but can also be used with forms created from frevvo' palette controls. The most common method is to connect the XML document to the form via the form's doc action manually set document URls wizard.
On this page:
XML document from Doc URI
The form designer ensures the XML document used to initialize the form is valid for the XSD schema used to create the form. If the XML document is invalid your form will fail to initialize and will display the message
"At least one document URI used to initialize the form is invalid. Please check the document at the URI and check it against any schema. Unexpected namespace : was expecting "
One example of an invalid XML document is when the XSD contains a repeating element. If minOccurs=3 and the XML document contains only 2 elements then the document is invalid and your form will display the standard error message.
The XML document must also use UTF-8 format encoding.
One way to initialize a form using the xml from a submission is to use the form URL shown in the Documents tab in conjunction with the document URls wizard. For example, let's say you want to display the form with data from an old submission to your users so they can edit it and create a new submission if needed. Follow these steps to populate a blank form with data from a previous submission.
- Open the submission that you want to use to populate the form.
- Click on the Documents tab.
- Copy the form link at the top of the xml. This link may show as the name of your document if the form was created from schema.
Change the //host:port of the URI to frevvo://
form URL from the Documents tab
- Copy the modified link to the Manually Set Doc URIs wizard. Remember to set the method to GET.
Save the changes and test your form.
Time, Date/Time Controls
Here is an example of XML code that can be used to initialize a form with date, time and date/time controls. The date and time data are not affected by the timezone. The date/tome control will be converted to the timezone of the browser and displayed in the form accordingly if the timezone is provided in the XML document. The "Capital Z" represents the timezone as shown below. Initialization data will not be converted and will display as is on the form if the timezone is not provided. The time for the date/time control is proceeded by a capital "T" (Time Zone) and followed by a "Z" (UTC timezone).
You must specify the _formTz=<tz> parameter appended to the share URL when initializing a form with time or date/time controls from an XML init document, the _data parameter or a business rule that uses the rule identifier,form.load. This is because the form server needs to know the timezone in which to return the date and time. Successful initialization cannot be guaranteed if the &_formTz parameter is not supplied. This URL parameter is not needed if your form/flow only contains date controls. Refer to Time Zones for the details.
For Example: the XML document shown below provides initialization data for the Product Order form via a Doc URI set up by the form designer.
Copying the Product Order share URL, without the &_formTz=<tz> parameter into a browser session and you may see an error message or the date/time control will remain empty while the separate date and time controls are filled when initialization is attempted.
Adding the &_formTz=America/New_York to the form URL will display the time on the screen in the America/New_York timezone and guarantee successful initialization:
Time data in a form is always converted from the browser's timezone to a valid UTC format when posted in the form XML document in the submissions database. You may see the time in UTC format with a trailing "Z" (UTC) time or the time value plus or minus the UTC offset. Refer to Viewing XML Documents for more information on the Submissions Database and the XML document.
Single digits for month and day in a rule or an xml document used to initialize a form will work only for the Date control. The Date/Time control requires a valid xml for successful initialization. See Rules Examples for more information.
XML document from Post payload
In addition to chaining multiple forms with common data sources from XSD together via the Form Action Post as described above, it is also possible to write a servlet or other web code that does a Post request with a form Url to the frevvo Form Server. This request can also be coded to contain an XML document. If the XML document conforms to and is in the same namespace as one of the form's documents (either from-scratch palette controls or from XSD schema datasource), then the Form Server will use that XML document to initialize the form's fields.