Fill-in-the-blanks type Question

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

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.

Hi Chris,

thanks for your reply. You can see an example of a gap fill exercise here.

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.

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?

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?

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/

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:

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?

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: