# Fill-in-the-blanks type Question

**URL:** <https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640>\
**Category:** Get Help\
**Tags:** gform\_pre\_submission, madlibs, conditional-logic, gform-validation\
**Created:** [April 29, 2020, 9:46am UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640 "2020-04-29T09:46:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5ea94bf4669f3569](https://avatars.discourse-cdn.com/v4/letter/u/67e7ee/32.png) [@user5ea94bf4669f3569](https://community.gravityforms.com/u/user5ea94bf4669f3569)\
**Post date:** [April 29, 2020, 9:46am UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/1 "2020-04-29T09:46:30Z")

</div>

Hi Everyone,  
I wanted to find out is it possible to create a Fill-in-the-blanks type question with gravity forms. I want to make a level test and one of the question types is a fill in the gap. Is it possible to use the single line text and have students match a keyword??

I can’t find anything online where someone has done this. Has anyone any ideas?

Many thanks

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [April 29, 2020, 3:19pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/2 "2020-04-29T15:19:42Z")

</div>

Can you show an example of the type of form you are looking to create? Either share the URL or an image, so we can be sure we’re talking about the same thing. Thank you.

---

<div class="post-metadata">

**Author:** ![user5ea94bf4669f3569](https://avatars.discourse-cdn.com/v4/letter/u/67e7ee/32.png) [@user5ea94bf4669f3569](https://community.gravityforms.com/u/user5ea94bf4669f3569)\
**Post date:** [May 4, 2020, 1:48pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/3 "2020-05-04T13:48:28Z")

</div>

Hi Chris,

thanks for your reply. You can see an example of a gap fill exercise [here](https://h5p.org/fill-in-the-blanks).

The way I have the form set up currently is with the short answer but I have to manually correct the submitted answers. As these types of question only have one correct answer I would really like to have gravity forms check if it matches and tell me if its correct. Any ideas how I would achieve this? or is it even possible.

Many thanks for your help.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [May 4, 2020, 4:44pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/4 "2020-05-04T16:44:20Z")

</div>

With your latest information, it sounds like you have two requests:

1. Make the form look like that
2. Ensure that the entered answers are validated before the form can be submitted

Is that correct?

---

<div class="post-metadata">

**Author:** ![user5ea94bf4669f3569](https://avatars.discourse-cdn.com/v4/letter/u/67e7ee/32.png) [@user5ea94bf4669f3569](https://community.gravityforms.com/u/user5ea94bf4669f3569)\
**Post date:** [May 4, 2020, 5:24pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/5 "2020-05-04T17:24:37Z")

</div>

Hi Chris,  
Exactly this. If it can be made to look like that, fantastic, but it isn’t as important as validating the word entered by the user. Is this possible?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [May 4, 2020, 8:22pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/6 "2020-05-04T20:22:58Z")

</div>

Cool. There is no feature in Gravity Forms that can make a form look exactly like that. Those are sometimes referred to as MadLib style forms. We don’t have that style by default in Gravity Forms, but it can be accomplished with some CSS. The demo no longer exists on our site, but it’s still archived here:

[https://web.archive.org/web/20120414123804/http://www.rocketgenius.com/gravity-forms-mad-lib-style-form-demo/](https://web.archive.org/web/20120414123804/http://www.rocketgenius.com/gravity-forms-mad-lib-style-form-demo/)

As for the validation of the word you have a couple options. One would be to use conditional logic on the next field that says “show this field when PREVIOUS FIELD is CORRECT” where CORRECT is whatever the correct answer is.

That will ensure they can’t see any more fields in the form until they get the answer right.

The other option is to let them enter everything, then use the gform\_validation filter to check what they submitted and see if it is correct. If so, let them pass; if not, return a validation error. Here’s the documentation for that filter:

> **[gform\_validation - Gravity Forms Documentation](https://docs.gravityforms.com/gform_validation/)**
>
> The "gform\_validation" filter allows custom validation logic to be used by Gravity Forms when a form is submitted. This allows more granular validation of fields than the default validation used.

---

<div class="post-metadata">

**Author:** ![user5ea94bf4669f3569](https://avatars.discourse-cdn.com/v4/letter/u/67e7ee/32.png) [@user5ea94bf4669f3569](https://community.gravityforms.com/u/user5ea94bf4669f3569)\
**Post date:** [May 11, 2020, 2:13pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/7 "2020-05-11T14:13:49Z")

</div>

Thanks for your help Chris. After looking into both options, the gform\_validation appears to be the best solution as in this case I want the student to attempt all of the gaps without knowing the results to test their level.

The best option I can see is number 5. Compare value against another field

However the hook displays the feedback on the form. Is it possible to use this hook and just have the result print out on the admin feedback if the answer is correct?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [May 11, 2020, 7:29pm UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/8 "2020-05-11T19:29:51Z")

</div>

If you don’t need to return the result, and instead want to store it in the entry for admin use, you can use gform\_pre\_submission rather than gform\_validation:

> **[gform\_pre\_submission - Gravity Forms Documentation](https://docs.gravityforms.com/gform_pre_submission/)**
>
> This action can be used to modify the posted values after form validation but prior to creating the entry.

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 5, 2022, 8:47am UTC](https://community.gravityforms.com/t/fill-in-the-blanks-type-question/4640/9 "2022-01-05T08:47:31Z")

</div>


