On this page:
What form definitions are
Form definitions are a set of X-HTML and X-Forms code that describe how the form is structured, what it collects, and how it interacts. It's an XML file that can be embedded in websites and applications. When you publish the form in the form builder, it's this file that's copied into the form runner.
Viewing a form's definition
You can view a form's definition from the editor screen.
- Click Advanced on the toolbox
- Click Edit Source
The Source window will display, showing you the code.
Editing a form definition
Editing a definition, especially directly, is discouraged.
- X-Forms are more complicated than regular HTML and XML
- Code for a given control can be in 2 or 3 places
- The Source window's size and wrapping can make editing more difficult
- Coding errors can have undesirable impacts
- There's basically nothing you could add or change that can't be done in the form builder interface
If you're comfortable with XML though, a good reason to edit the definition is to quickly add label/value pairs to long pulldown, checkbox or radio button controls. These can be much faster to type (or copy from another resource) than set up through the interface.
In this or similar cases:
- Add the controls you need to the form and name them
- Save your form
- Save your form definition
- Use an XML editor (like Notepad++) to edit the file
- Save the file
- Replace the current definition with the new one
- Save your form
Saving a form definition
You can save (export) a form definition to:
To export a form definition:
- Click the XHTML Export button. The Save As window is displayed
- Edit the file name, if desired. Consider adding the current or edition date
- Navigate to the location where your want to save the file
- Click Save
Sharing a form definition
You may have a form that someone from another ministry would like to use to build their own.
Simply provide them with:
- The form definition
- Any embedded files they'll need, like images
- Any PDFs or design files used
- Any other records or supporting information that would be useful to them
Consider just compressing your latest edition records into a zip file and emailing it to them.
Using someone else's definition
If someone from another ministry has shared a form definition and related files with you, you'll import this new form into your environment in 3 basic steps:
- Edit the Application name in the form definition
- Create a new form and replace the source code
- Import any assets needed
To edit the shared definition:
- Open the definition using a text or XML editor
- Locate the <Application> tag
- Change the value to the Application you use
- Save the change
- Select the content of the file (Control-A)
- Copy the content of the file (Control-C)
Editing the tag helps ensure that the form will appear properly in your environment.
To 'import' the form:
- Create a new form
- Give it any Form Name and ignore the other fields
- These will be replaced by the imported definition
- Click Edit Source in the Advance toolbox. The Source window is displayed
- Select the contents of the Source window (Control-A)
- Replace the contents of the Source window (Control-V)
- Click Apply
- Click Form settings in the Advanced toolbox
- Update the Basic Settings as desired
- Click Apply
- Click Save
You'll now have a copy of the form in your environment, ready for editing.
Importing assets:
Assets are things like images or PDF templates that have been added to the form.
Orbeon will know these files are supposed to present, but won't have a copy of them in the database. You'll need to 're-import' them to add the files to the database.
- For images, simply click the "X" to remove them from the control, then upload the replacement image
- If the image is a program or ministry wordmark, you'll likely want to use the correct one anyway
- For templates, simply click the "X" next to the template name, then upload the replacement template
- To access the templates, click PDF Templates in the Advanced toolbox
- You may want to edit and revise the template before you upload it or publish the form
These actions will add the images or templates to the database for testing and publishing.
Restoring a form with a saved definition
You may need to restore a form to a previous definition when:
- A minor revision is cancelled before release
- An urgent revision to the released form is needed during a minor revision
- The client wants to "roll-back" a released minor or major revision
To restore a form definition to an earlier version:
- Open the saved definition with a text or XML editor
- Select the contents of the defninition (Control-A)
- Copy the contents of the defninition (Control-C)
- Open the form's Source window
- Select the contents of the form's source code (Control-A)
- Replace the contents of the form's source code (Control-V)
- Click Apply
- Click Save
Post-restoration steps:
Depending on the differences between editions and the status the form was in, you may need to: