Prepopulating or Prefilling Forms Using Query String Parameters
  • 03 Jul 2024
  • 1 minute read
  • Dark
    Light
  • PDF

Prepopulating or Prefilling Forms Using Query String Parameters

  • Dark
    Light
  • PDF

Article summary

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 and color

  • The values are ferret and purple

  • 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

www.slateuniversity.org/register/moreinfo?person={{Person-GUID}}

Application

GUID from the Application Query Base

www.slateuniversity.org/register/admitstudentday?person={{Application-GUID}}

Dataset

GUID from the Dataset's Query Base

www.slateuniversity.org/register/counselorinfo?person={{Organization-Contact-GUID}}

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}}

  • www.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

www.slateuniversity.org/register/moreinfo?sys:field:acainterest=84fcea7a-72e6-4743-8594-4c25c1c25015

Prompt Driven

No

The prompt's exact value

www.slateuniversity.org/register/campusvisit?lunch_preference=Chicken

Free Response

n/a

A string

www.slateuniversity.org/register/moreinfo?sys:first=Alexander&sys:last=Hamilton

A prompt's GUID is visible when accessing that prompt in the prompts tool:

guid.png

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&amp;output=embed&amp;div=form_48125437-447b-4638-925b-5ee8b09808cf">/**/</script>
      


Was this article helpful?