- 03 Jul 2024
- 1 minute read
- Print
- DarkLight
- PDF
Prepopulating or Prefilling Forms Using Query String Parameters
- Updated 03 Jul 2024
- 1 minute read
- Print
- DarkLight
- PDF
A query string parameter uses the content of a URL to pass information to a webpage.
The information is contained in a parameter and its value. They follow a ?
at the end of the URL path.
For example: https://example.com/path/to/page?name=ferret&color=purple
The query string begins after
?
The parameters are
name
andcolor
The values are
ferret
andpurple
The
&
chains multiple parameters together
Query string parameters in Slate
In Slate, query string parameters can do things like:
Tell a form which person record is filling it out
Pre-populate form fields, like an academic interest
For a Record
You can use person record parameter’s with that record's unique identifier to pre-fill system fields on a form.
The record is updated upon submission of the form.
📝 Parameters must be in all lowercase. Values can contain uppercase letters.
Form Scope | Configurable Joins Export to Use | Example URL |
---|---|---|
Person | GUID from the Person Query Base |
|
Application | GUID from the Application Query Base |
|
Dataset | GUID from the Dataset's Query Base |
|
If your URL already includes a query string parameter, you will need to append this additional parameter with an ampersand &
instead of a question mark ?
.
For instance:
www.slateuniversity.org/register/moreinfo
would be be appended with?person={{Person-GUID}}
w
ww.slateuniversity.org/register/?id=48125437-447b-4638-925b-5ee8b09808cf
would be appended with&person={{Person-GUID}}
In a mailing
If a query string parameter uses a merge field in a mailing, that merge field must:
Be included as an export in the mailing's recipient list
Match the export's Name setting. If the export's Name setting has spaces, the merge field will replace those spaces with dashes
-
. For instance, "Academic Program" would become{{Academic-Program}}
For a Form Field
Slate can prepopulate a form field using a parameter and a value. The parameter will be the form field's Export Key (e.g., sys:first
, sys:field:acainterest
).
The value being passed in, however, must respect the form field type being used:
Form Field Type | Is the Field Mapped? | Acceptable Value | Example |
---|---|---|---|
Prompt Driven | Yes | The prompt's GUID |
|
Prompt Driven | No | The prompt's exact value |
|
Free Response | n/a | A string |
|
A prompt's GUID is visible when accessing that prompt in the prompts tool:
It is possible to concurrently pre-populate:
Multiple form fields
A form field with multiple values
Embedded Forms
If you wanted to prefill a program of interest form field with an Export Key of sys:field:acainterest and a value of "Computer Science" (using the example prompt above), the embed code would be something like:
<div id="form_48125437-447b-4638-925b-5ee8b09808cf">Loading...</div><script
async="async" src="https://www.slateuniversity.org/register/?id=48125437-447b-4638-925b-5ee8b09808cf&sys:field:acainterest=84fcea7a-72e6-4743-8594-4c25c1c25015&output=embed&div=form_48125437-447b-4638-925b-5ee8b09808cf">/**/</script>