How to disable 'Submit' button in multiple Answers question

Nov 24, 2021

I want to create a multiple Answers question with the following conditions. There are 4 options and 2 correct answers. 

When the learner selects mores than 2 options or select only one option or no option, then the Submit' button should be in the disabled state. 

When the learner selects any 2 options then only the Submit button should in the normal state. 

Can we create this question using only triggers and not using variables?

 

1 Reply
Richard Watson

Vikas,

I noticed this post is a little dated but just in case you drop by (or if someone else wants to do this), I wanted to provide you with one approach you might find useful. You could probably accomplish this with a combination of triggers and conditions but it is much easier (and more helpful) when you add a simple number variable and help direct the user when they make a mistake. 

Example: 

- Set the Slide Properties to "Reset to initial state" when revisiting.

- Create a number variable (v_Counter) to track how many answers the user selected

On base layer:

-Add a trigger to reset the variable v_Counter to 0 when the timeline starts on this layer; this will reset the user attempts back to 0 and set up the question for the next attempt.

Action: Adjust variable
Variable: Set v_Counter to value 0 when the timeline starts on this slide

Create triggers to fire after the user clicks this Submit button to adjust the variable by 1 if the state of the checkbox is selected. Do the same for the other three checkboxes. This will count the number of answers the learner selects.

Example for Checkbox 1:

Action: adjust variable
Variable: Add value 1 to v_Counter
When: When the user clicks the submit button
Condition: If the state of checkbox 1 = selected

Create a trigger that shows the "incorrect qty selected" layer if the v_Counter variable does not equal 2.

Action: Show layer
Layer: Incorrect Qty Selected
When: When the user clicks the submit button
Condition: If v_Counter is not equal to value 2

To provide more information to the user when they don't select at least two answers, you could create two more layers. This will require that you create two more triggers on the base layer. Note: This assumes the correct answers are Checkbox 1 and Checkbox 2 in this example

Action: Show layer
Layer: Try Again
When: When the user clicks the submit button
Condition: If v_Counter = value 2 and the state of checkbox 1 = Normal and the state of checkbox 2 = Normal (normal state means the two correct answers were not selected)

Action: Show layer
Layer: Correct
When: When the user clicks the submit button
Condition: If v_Counter = value 2 and the state of checkbox 1 = selected and the state of checkbox 2 = selected

Incorrect Qty Selected Layer

On this layer, create a trigger that Jumps to this slide when the user closes the layer (e.g., click a button or hotspot you create on the layer to close it).

To help the user understand what they did not do correctly, add text that says, "Try Again. You must select two of the options. You selected %v_Counter%.

Correct Layer

Add a trigger to take the user to the next slide in your course

Try Again Layer

To help the user understand what they did not do correctly, add text that says, "Try Again. You selected the correct number of options but your selections were incorrect. 

On this layer, create a trigger that Jumps to this slide when the user closes the layer (e.g., click a button or hotspot you create on the layer to close it).

If you want to see a working copy of this, go here.

Hope this helps you!

Richard