Fill in the Blanks – how to allow only specific combinations?

I’m creating a Fill in the Blanks question in ActivePresenter:

… x … = 32

Here’s how I set the Correct Values:

  • First blank: 4, 8

  • Second blank: 4, 8

My goal:
:white_check_mark: Accept only these two combinations:

  • 8 x 4

  • 4 x 8

The issue:
:cross_mark: Because both blanks accept both values, 4 x 4 and 8 x 8 are also marked as correct.

:backhand_index_pointing_right: Is there a way to restrict the Fill in the Blanks question so that only the combinations 8 x 4 and 4 x 8 are valid, but not 4 x 4 or 8 x 8?

Some ideas…

  1. Would it work to use just one blank and accept 4x8 or 8x4?
  2. Could it be stated in the instructions to use each number one time?
  3. Make a drag and drop that looks like a fill in the blank and they only get one of each 0-9
  4. Craft your own fill in the blank with text entry boxes and JavaScript to control the logic.

Just brainstorming…

1 Like

Thank you for the ideas.

My goal is to solve this within the existing Fill in the Blanks question type, using the standard question features. I’m using this system for Review Mode VS, so I want to keep it fully compatible with the built-in workflow.

I wonder if it’s possible to control this kind of combination logic using the onChange event or any other available actions for the blanks, without switching to custom text entry boxes and JavaScript. Is that feasible?

@Hang
@PhuongThuy_Le

Do you know a way for me to solve this problem?

Hi Burhan,

Please find the project file attached for your reference. The code has been added to the Submit button:

var questionObj = prez.object(‘your_question_name’);if (!questionObj) {return;}
var $inputs = $(questionObj.node).find(‘input[class*=“ap-input-fib”]’);
if ($inputs.length !== 2) {return;}
var value1 = $inputs.eq(0).val().toString().trim();var value2 = $inputs.eq(1).val().toString().trim();
var isValid = (value1 === ‘8’ && value2 === ‘4’) || (value1 === ‘4’ && value2 === ‘8’);var isEmpty = !value1 || !value2;
if (isEmpty) {prez.showFeedbackByName(‘Incomplete Feedback’);} else if (isValid) {prez.showFeedbackByName(‘Correct Feedback’);var currentScore = prez.variable(‘total_score’) || 0;prez.variable(‘total_score’, currentScore + 1);} else {prez.showFeedbackByName(‘Incorrect Feedback’);}

fill_in_blanks.approj (1.1 MB)

Hope this helps!

1 Like

Hi Hang,
Wooow, you’re amazing. Thank you so much for your help.

1 Like