🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Fill-in-the-Blank Setup Guide

Updated 13 min read Gravity Forms Integrations A–Z
On this page
  1. What you need
  2. Install and activate
  3. How it differs from other tools
  4. Add the field and write the sentence
  5. Brackets that are not blanks
  6. Settings of each blank
  7. What visitors see
  8. Accessibility
  9. How values are checked
  10. Merge tags
  11. Conditional logic on a blank
  12. Entries, entry list and export
  13. Gap-fill quiz mode
  14. Changing the sentence later
  15. Examples
  16. Club membership agreement
  17. Language class gap-fill
  18. Court or room booking
  19. Pledge or sponsorship form
  20. For developers
  21. Permissions and uninstall
  22. Frequently asked questions
  23. Can a blank have a default value?
  24. Can I use the same blank twice in one sentence?
  25. Do the correct answers appear in the page source?
  26. What happens to entries if I change the sentence?

The Gravity Forms Fill-in-the-Blank add-on adds a Fill in the Blank field to Gravity Forms. Instead of one input under one label, the field shows a sentence or a short paragraph with the inputs inside it, exactly where the missing words go: “I, ____, would like to join the club as a ____ member and will pay ____ by ____.” Each blank is a separate, fully checked part of the field, so merge tags, conditional logic, the entry screen and the CSV export all work per blank. An optional gap-fill quiz mode marks each blank against your answers and stores a score on the entry. This guide covers installing the add-on, writing sentences and blanks, the settings of each blank, what visitors see, how values are checked, merge tags, conditional logic, entries and export, the quiz mode and a few complete examples.

What you need

You need Gravity Forms 2.9 or newer, WordPress 6.5 or newer and PHP 7.4 or newer. The add-on adds no database tables and no scheduled tasks of its own. Everything it does runs on your own server; it makes no outside request beyond the usual licence and update checks.

Install and activate

  • Upload the add-on zip in Plugins → Add New → Upload Plugin and activate it.
  • Go to Forms → Settings → Fill-in-the-Blank, enter your GravityExtra licence key and press Activate License.
  • Open a form in the form editor. The Fill in the Blank button is in the Advanced Fields group.

Without an active licence, the button is not offered and existing Fill in the Blank fields are not shown on the front end, so a visitor never meets a half-working field. Their settings stay in the form and the values already stored in entries stay readable. When the licence is active again, the fields come back as they were.

How it differs from other tools

Gravity Forms itself puts one input per field, under its label. Fields that have several inputs, such as Name or Address, still show them as a stack of boxes with small sub-labels. None of them lets you write a sentence and place inputs inside it.

The add-on also does a different job from several of our other add-ons, and works well next to them:

  • Our Survey, Quiz & Poll Tools add-on grades quizzes built from normal choice fields (radio buttons, drop-downs, checkboxes) and adds Likert, ranking and rating fields. Fill-in-the-Blank marks typed answers inside a sentence, with alternatives, case and space options. The two can sit on the same form; each keeps its own score.
  • Our Scored Assessments add-on adds up points per category to reach an outcome such as a working style or a readiness level. Fill-in-the-Blank does not work with categories or outcomes: it says whether each blank is right or wrong and adds up the points.
  • Our Dynamic Labels add-on changes the text of a label from a value, such as a URL parameter, another answer or the logged-in user. It does not place inputs inside text. Fill-in-the-Blank puts the inputs inside your own fixed sentence.
  • Our Field Group Container add-on wraps whole fields in a styled box with a heading. Fill-in-the-Blank is a single field whose parts are the blanks of one sentence, so it can itself sit inside such a group.

Add the field and write the sentence

Add a Fill in the Blank field and give it a label, for example “Membership agreement”. The label becomes the legend of the field. In the field settings you will find the Sentence with blanks box. Write the text as you want people to read it and put each blank in square brackets:

  • [name] is a text blank. A blank without a type is always text.
  • [fee:number] is a number blank.
  • [email:email] is an e-mail blank.
  • [due:date] is a date blank with the browser’s date picker.
  • [plan:select=Junior|Adult|Family] is a drop-down with the choices Junior, Adult and Family.

The part before the colon is the blank’s name. It starts with a letter and may contain letters, digits, hyphens and underscores, up to 32 characters. Upper and lower case do not matter, and each name can be used once per field. The type after the colon can be text, number, email, date or select. Line breaks in the sentence are kept, so a field can hold a short paragraph.

Brackets that are not blanks

Type \[ and \] when you want a square bracket to appear as text, and \\ for a backslash. Inside the choices of a drop-down, \| is a literal bar, so [size:select=S\|M|L] offers the two choices “S|M” and “L”. Text in brackets that does not look like a blank at all, such as “[see clause 4]”, simply stays as text.

When something looks like a blank but cannot be used, the editor says so under the sentence box and the text is shown as it is: a name used twice, an unknown type, choices on a blank that is not a drop-down, or a drop-down without choices. A field can hold 20 blanks; any further blank is shown as text with a note.

Settings of each blank

Below the sentence box, every blank gets a small card with its name, its type and its own merge tag. The cards update while you type the sentence.

The Fill in the Blank field settings in the form editor: the sentence box with blanks in square brackets, a note on the syntax, and a card for each blank with its type, merge tag, label, required flag, placeholder, width and range
Field settings: write the sentence with the blanks in square brackets, then give each blank its label and checks.
  • Label: the name screen readers announce for this blank, also used in entry columns, the export, conditional logic and error messages. If you leave it empty, the blank’s name is used (“pay_by” becomes “Pay by”), so a clear label is worth the few seconds.
  • Required: the blank must be filled in. If you mark the whole field as required in the usual Rules setting, every blank is required.
  • Placeholder: a short hint shown in an empty text, number or e-mail blank, or the first line of a drop-down (default “Choose”).
  • Width: the width of the input in characters, from 2 to 60. Sensible defaults are used when you leave it empty: 16 for text, 8 for numbers and 24 for e-mail addresses.
  • Minimum and maximum: for number blanks a number range, for date blanks a date range written as YYYY-MM-DD. The browser’s date picker also respects the range.
  • Pattern: for text blanks a regular expression the whole answer must match, for example [A-Z]{2}\d{4} for two capital letters and four digits, with your own message for answers that do not match. A pattern that is not a valid expression is ignored.

The usual Gravity Forms settings still apply to the field as a whole: description, CSS class, label placement, visibility, a custom validation message and conditional logic for the whole field.

What visitors see

The sentence is shown as normal text with the inputs in place of the blanks. Inputs are as wide as you set them and wrap onto the next line with the text, so the sentence stays readable on a phone. The field follows the text direction of the page, so it works in right-to-left languages too.

A club membership form written as one sentence: I, Robin Hale, would like to join Meadowfield Tennis Club on the Junior plan, with the name, membership type, season fee, payment date and e-mail address typed into inputs inside the text, and a Parent or guardian field shown below because Junior was chosen
A membership agreement as one sentence with five blanks inside it; choosing Junior in the drop-down blank shows the guardian field.

While a visitor fills in a blank, a small script previews the checks of that blank: a fee that is not a number, a date outside the range or an e-mail address without a domain is marked at once with a short message under the sentence. This is only a preview. Nothing is decided in the browser.

Accessibility

  • The field is a fieldset with the field label as its legend, like the core Name and Address fields.
  • Every blank has its own label. The labels are visually hidden, because the sentence itself is the visual label, but they are there for screen readers.
  • Every input is described by the whole sentence, with each blank named in brackets, and by the field description. A screen-reader user hears “Your full name, edit text” and then the complete statement they are filling in.
  • The inputs follow the order of the sentence, so the Tab key moves through them in reading order. No custom tab order is used.
  • Required blanks carry aria-required, and a blank the server refused carries aria-invalid, with the message listed under the sentence.

How values are checked

When the form is submitted, the server reads each blank on its own and checks it, whatever the browser did or did not check. HTML tags and control characters are removed and runs of spaces become one space. Then each type has its own rules:

  • Text: up to 200 characters; your pattern, if you set one.
  • Number: digits with an optional sign and decimals, a dot or a comma as decimal separator. “045.00” is stored as “45” and “7,5” as “7.5”. A comma followed by exactly three digits, such as “1,000”, is refused because it could mean one thousand or one. Letters, exponents and anything else are refused. Then the range is checked.
  • E-mail: a complete address with a domain, checked with the WordPress check as well.
  • Date: a real calendar date (the 30th of February is refused) and inside the range.
  • Drop-down: one of the listed choices. A different upper or lower case is corrected to the choice; any other value is refused, even if someone edits the page to send it.

A refused blank stops the submission like any other Gravity Forms validation error. The message names the blank, for example “Season fee in dollars: please enter a number from 40 to 400.”, and no entry is created. Only the cleaned values are stored.

Merge tags

Each blank is stored as a sub-input of the field, with the number shown on its card. If the field is “Membership agreement” with ID 1:

  • {Membership agreement:1} is the whole filled-in sentence. In HTML e-mails and confirmations the values are bold; dates are shown in your site’s date format.
  • {Membership agreement:1:plain} is the same sentence as plain text.
  • {Membership agreement:1.3} is a single blank, as stored (dates as YYYY-MM-DD).
  • {all_fields} shows the filled-in sentence for the field.

Quiz fields add {Label:ID:score} (“3 / 5”), {Label:ID:percent} (“60”) and {Label:ID:feedback}, the marking of each blank, and {fillblank_total} and {fillblank_max} give the total of all quiz fields of the form. The quiz merge tags are in the merge tag list of the editor.

Conditional logic on a blank

Each blank appears in Gravity Forms’ conditional logic lists as “Field label (Blank label)”, just like the parts of a Name field. You can show a field when a single blank has a certain value, send a notification only when a drop-down blank is “Junior”, or skip a confirmation for a certain answer. The logic runs live in the browser for fields and is checked again on the server, so a field that is shown by a blank is required on the server only when it is really shown.

Entries, entry list and export

  • The entry screen shows the filled-in sentence with the values in bold.
  • Each blank can be an entry list column, and the field column shows the sentence.
  • In Forms → Import/Export → Export Entries, every blank is its own column, named “Field label (Blank label)”, and “Field label (full sentence)” gives the sentence as it was filled in. Quiz fields also offer the score per field and the total.

The full sentence is saved with the entry when it is submitted, so the export shows the statement exactly as the person saw and completed it, even if you reword the sentence later. When you edit an entry in the admin, the sentence and the scores are worked out again.

Gap-fill quiz mode

Tick Gap-fill quiz in the field settings to mark the blanks. Each blank card then has three more settings:

  • Correct answers: one or more accepted answers, separated by |. “Paris|paris city” accepts both. Use \| for a bar inside an answer.
  • Points: what a right answer is worth, 1 when empty, up to 1000.
  • Feedback when wrong: a short hint shown in the marking when the answer is wrong.

Two options apply to the whole field. Upper and lower case must match is off by default, so “Soy” and “soy” are both right. Spaces in answers either ignores extra spaces at the ends and between words (the default) or ignores all spaces. Curly and straight quotes and apostrophes count as the same. Number blanks are compared as numbers, so “20”, “20.0” and “020” are the same answer; date blanks compare the date; drop-downs compare the chosen option. A blank without answers is not marked and does not count towards the maximum.

A Spanish lesson gap-fill form: Me llamo Ana y soy de México. Mis padres vive en Puebla. Tengo 20 años y el cielo es azul, with the answers typed into inputs inside the sentences and a second part with one more gap
A language-class gap-fill: the learner types the missing words inside the sentences; the answers are marked on the server.

The marking happens on the server after the entry is saved, from the stored values only. The correct answers are never sent to the page, and anything the browser sends about a score is ignored: a score can only come from the answers. For each quiz field, the score is stored on the entry, together with the marking of each blank, and the form gets a total. Scores and the total are entry meta, so they can be entry list columns, export columns and conditions in notification and confirmation logic, for example a “Top marks” e-mail when the total is greater than 5.

The Fill-in-the-blank marking box on an entry: About Ana 3 / 5 with each blank marked correct or with the expected answer and feedback, and Part 2 1 / 1
On the entry screen, each quiz field shows its score and every blank as right or wrong, with the expected answer and your feedback.

On the entry screen, the Fill-in-the-blank marking box shows each quiz field with its score and every blank as right or wrong, with the expected answer and your feedback. The stored marking does not change when you later edit the answers in the field settings, so earlier results stay as they were given.

Changing the sentence later

Each blank keeps its sub-input number for as long as it keeps its name. You can reword the sentence, move blanks around or add new ones, and the values already stored in entries stay attached to the right blank. A new blank gets the next free number. If you remove a blank and later add one with the same name again, it gets its old number back. Renaming a blank makes it a new blank.

Examples

Club membership agreement

I, [name], would like to join Meadowfield Tennis Club on the [plan:select=Junior|Adult|Family] plan. I will pay the season fee of $[fee:number] by [due:date] and can be reached at [email:email]. Mark the field as required, set the fee range to 40 to 400 and the date range to the season. Add a “Parent or guardian” field shown when the plan blank is “Junior”, and a notification to the coaches with the same condition.

Language class gap-fill

Me llamo Ana y [ser] de México. Mis padres [vivir] en Puebla. Tengo [edad:number] años. Turn on the quiz mode, give “soy”, “viven” and “20” as answers, use the placeholders to show the infinitive, and add feedback such as “Ellos / ellas: -en”. Use {Label:ID:feedback} in the confirmation so learners see what to practise.

Court or room booking

Please book court [court:select=North|South] for [players:number] players on [day:date], booking reference [ref]. Set the players range to 1 to 4 and a pattern on the reference, and use {Booking:1:plain} as the e-mail subject line.

Pledge or sponsorship form

I, [name], pledge $[amount:number] for every lap [runner] completes. The sentence reads like the promise it is, and the export gives you the name, amount and runner in separate columns.

For developers

After the total of a form’s quiz fields is worked out, the action gffillblank_scored fires with the total, the entry and the form, so you can pass the result on to your own code. The field type is fillblank, and each blank is a regular sub-input ID.k in the entry, so rgar( $entry, '1.3' ) reads a single blank.

Permissions and uninstall

The add-on has no admin page of its own. The field is edited in the form editor, so staff who can edit forms can set it up, and entries follow your usual Gravity Forms entry permissions. The licence settings need the Gravity Forms settings permission.

Uninstalling the add-on through Forms → Settings → Uninstall removes its options, its licence check and the entry meta it stored (full sentences, scores and marking). Your forms, their fields and the values of every blank in your entries are kept.

Frequently asked questions

Can a blank have a default value?

Not in this version. Use the placeholder to show an example or a hint instead.

Can I use the same blank twice in one sentence?

Each name can be used once per field. If you need to repeat a value, use the blank’s merge tag in the confirmation or a second field.

Do the correct answers appear in the page source?

No. The answers stay on the server. The page only receives the sentence, the inputs and the messages of the checks.

What happens to entries if I change the sentence?

Values stay with the blank of the same name, and the full sentence saved with each entry shows what the person saw at the time.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr