How to pre-fill a form using URL parameters or OpenURL links
You can pre-fill a form's fields by passing values in a URL, using either a custom URL string that you create, or an OpenURL link. When a user clicks on one of these links, they'll be taken to your form with the fields already filled out using the values passed from your URL.
- Custom URL: this option allows you to create URLs that pass specific values to one or more fields. These values are contained inside of parameters, which are appended to the end of your form's URL.
- OpenURL: this option allows you to map fields in your form to specific OpenURL parameters, which would pass citation info to your form from something like your link resolver or catalog.
Custom URLs can come in handy if you want to link to your form with certain fields already filled out. For example, if you are linking to your library's contact form from your Circulation department webpage, you could use a custom link that automatically selects "Circulation" as the type of inquiry.
OpenURL links have a more specific purpose: they are used specifically to pass citation information in a standardized format.
For example, if you have an interlibrary loan request form, you could map fields like "Author" or "Title" to the appropriate OpenURL parameters. You could then link to your form from your link resolver, which would pass those values to your form. LibWizard would then use your mappings to assign the values in the OpenURL link to the corresponding form fields. That way, all of the information about the book or article the patron wants will already be filled out -- all they need to do is submit the form!
To create a custom URL or map OpenURL parameters for your form:
- While editing your form, click on the Form Options tab.
- Click on the Advanced panel to expand it.
- Under Pre-filled Form via URL, click on the Configure URL settings button to launch the Configure Pre-filled Form via URL window.
See the sections below to learn more about the available options.
By default, the option to pre-fill your form via a URL will be disabled. Before you can create custom URL strings or map OpenURL parameters, you must first turn this on.
- In the Configure Pre-filled Form via URL window, toggle the switch from Disabled to Enabled.
- When enabled, the options for create custom URL strings and mapping OpenURL parameters will appear. You can learn more about these in the sections below.
- When disabled, OpenURL links and any custom URLs previously created will no longer pre-fill your form's fields.
- Once finished making any changes, click the Save button to preserve your enabled/disabled selection.
A custom URL string allows you to pre-fill one or more fields with the values of your choice. LibWizard provides a simple interface that allows you to fill out each field -- just like you would on your actual form. Once you're finished, LibWizard will then generate a URL to your form that includes pairs of parameters and values. When a user visits that URL, LibWizard will match those parameters to the corresponding form fields and fill in the preset values automatically.
You can use your form's URL builder to create as many different URL strings as you'd like, each with different pre-filled values. (For best results, we recommend creating a friendly URL for your form if you haven't already.)
- Under the Create Custom URL string tab, you'll find a list of all input fields in your form.
- Utility fields, such as text blocks and line separators, will not be listed.
- File upload fields will be listed, but cannot pre-filled. (These will appear grayed out.)
- To pre-fill a field, click on it's name. This will display the field, just as you would see it on your form's public page.
- Enter or select the value(s) that you want to be pre-filled in that field.
- Repeat Steps 2-3 for each field you want to pre-fill, then click the Generate custom URL string button.
- The URL will display above the button and should automatically be copied to your clipboard. However, you can also manually copy it, if needed.
- Important: your custom URL strings are not saved, so be sure to copy and paste them before closing the window or generating another URL.
- Please note that URLs are generally limited to a maximum of 2,048 characters. Please keep this in mind when pre-filling fields such as one-line text and textareas, which can accept a large number of characters.
- When finished, click the Save button to close the window.
When you build a custom URL string, you'll notice that the generated URL will use each field's unique ID number rather than its name. That's because a field's ID will never change, but its short name can. However, field IDs and short names are interchangeable. If you'd like, you can edit a URL string and replace each ID number with the corresponding short name, which you can find under the View Field IDs & Short Name Parameters tab. For each input field of your form, you'll find it's Field ID and Short Name for your convenience. To edit a short name, return to the Workpad and edit that field.
The benefit of using short names is that you can more easily identify the parameters in your URL, which can be helpful for editing and troubleshooting. The drawback to using short names, of course, is that they are not static: so if a short name gets changed, it would also have to be updated in your custom URL. Otherwise, that particular field would no longer be pre-filled.
For best results, therefore, we recommend that you do not change the short names of your fields once you start using them in your URLs.
In addition to pre-filling your forms with custom URLs, you can also use OpenURL links to pre-fill citation information from a link resolver, catalog, or similar system. For this to work, you must first map your form's input fields to a specific OpenURL parameter, such as
rft.issn. That way, when LibWizard receives an OpenURL string, it'll know where to assign the value of each parameter in your form.
Once you've mapped your OpenURL parameters, all you need to do is link to your form's URL from your link resolver or other system. That system will then pass an item's citation details to your form using OpenURL parameters.
For your convenience, you'll find a sample URL for your system that will look something like this:
Breaking this URL apart:
- This is the URL for your form (we recommend giving your form a friendly URL). This is what you'd link to from your link resolver or other system.
- This is a string containing the OpenURL parameters and their values, an example of what would be provided by your link resolver or other system to LibWizard.
To map your form's fields to OpenURL parameters:
- Click on the Map OpenURL Parameters tab.
- For each field you want to map, use the Map to OpenURL Parameter dropdown to select the corresponding parameter. (You can only map one parameter per field.)
- For example, if you map the rft.title parameter to a one-line text field, the value of the rft.title parameter will pre-fill that field.
- For best results, we recommend mapping only one-line text or textarea fields to OpenURL parameters, since these will contain text values.
- If you're not sure what a particular OpenURL parameter is for, click on the OpenURL Cheatsheet panel to see a full list of parameters and the data they contain.
- When finished, click the Save button. You can return here any time to change or remove your form's mappings.