How to set a max number of drop items per drop target.

Oct 15, 2014

Hi team,

I have a drag and drop quiz where there are 5 draggable items and one drop target for the correct answers. There are 3 correct answers. I'd like to make it so that only 3 items can be dropped in the target at once (regardless of whether they are correct or not).

Can anyone help with this?

8 Replies
Jacqueline Kelsall

I did the following in order to make the submit button only active when the drop target has 3 items on it.

Created a variable that would +1 when an item was dropped in the correct target and -1 when the item was returned to the original spot (using invisible boxes - note I will remove the hover state of the invisible boxes). 

Added condition that learner could only click submit when variable = 3.

But for some reason I keep being able to break it.

and I'm not sure at all how to only allow 3 in the target area at any one time....

Rebecca Fleisch Cordeiro

Hi Jacqueline and Wendy,

Wendy, hope you're up and running soon!

Jacqueline, there are various ways you can do this, depending on when you want the interaction to be interrupted. Here's one way. This way prompts Learners with a reminder if they forget and drag more than 3 items. I

  • Added an additional layer, and named it "only 3." it's actually a duplicate of your instructions layer, but I changed the text to prompt Learners and changed your Start button to an OK button.
  • Added a trigger to show that layer if your 219COUNT variable is = or greater than 4

I added a text box on the slide with a reference to the count so you can see what's going on

I was trying to work within what I think is your design, which allows Learners to drag items back and forth. Speaking of which,

  • I think you might be better off making a change to the "drag back" part of the design (see below)


  • You''ll notice I made a change to your invisible boxes. I added a dotted light grey outline to them and typed the words "option 1, option2," etc. into each one.

    The reason I did that: sometimes when I was dragging items back, the count didn't subtract. This happened if, for example, Option 2 ended up on the option 1 (or 3, 4, 5) invisible box when I released. It's because you have the trigger set up to only subtract if Option 2 is dropped back on option 2, so if it accidentally gets dropped on Option 1, 3, 4, or 5, the count is not subtracted.

A better way to set this up might be to simply have one large invisible target for Learners to drag their answers back onto. That way they needn't worry about dragging back on the exact numbered rectangle. Otherwise, they could end up in a loop they can't get out of once they reach a count of 4.

Please shout out with any questions.

Jacqueline Kelsall

Thanks Rebecca, I really appreciate your help. Unfortunately, I am still able to break this model, because +1 and -1 still occurs if the drag item is lifted from it's position and dropped back onto the same position.

For example, if I drag option 1 to the target, +1 is added to the count. If I then click on the item (already sitting in the target) and drag it slightly, it snaps back to the target and adds +1 to the count. In this way, we can reach +4 with only 1 item in the target!

I'm thinking that I might have to create a triggers with states instead.... trying to explore any option that will work right now! Please let me know if you have any other ideas

Rebecca Fleisch Cordeiro

HI Jacqueline,

Ah ... I hadn't tested for that part. Good for you! That can be accommodated by creating a T/F variable. I've attached a new story. I've only done part of the work and you may want to fiddle with formatting, but this should get you going.

  • So, first, I deleted all of the add/subtract triggers and removed the condition on the Submit button, to get a fresh start. 
  • I also removed all your invisible rectangles and replaced them with one large rectangle that I named #undrop. The only reason I placed a # sound as the first character was to move it up higher in the trigger list.
  • This #undrop rectangle currently has a dotted line simply to "guide" the Leaner. Note its position in the timeline: it needs to sit under all your option rectangles or it won't work.

By adding T/F variables you can control that issue where Learners may keep moving an already dragged/dropped object. I've created the variables and the triggers for Rectangles Options 1 and 2; you'll need to do the rest. 

I've created an OPTION1 T/F variable; default = F

I've created an OPTION2 T/F variable; default = F

So, for example there are 4 triggers for Option1Rectangle 16

Add 1 to the 219COUNT variable when Option1Rectangle 16 is dropped on Rectangle 25 (your target) IF OPTION1 variable = False

Adjust OPTION1 variable = T when Option1Rectangle16 is dropped on Rectangle 25.

Subtract 1 from the 219COUNT variable when Option1Rectangle 16 is dropped on #Undrop Rectangle (the new one I created) IF OPTION1 variable = True

Adjust OPTION1 variable = f when Option1Rectangle16 is dropped on #Undrop Rectangle.

Same for Option2Rectangle 21

Again, you'll need to do these for your Option 3, 4, 5 rectangles.

Please shout out with any questions!

Wendy Farmer

Hi Becky

just had a look at the story file and If I understand Jacque's initial request I think the issue is that you can still drag more than 3 option boxes to the 'DROPZONE' which she doesn't want.  So what do you suggest when the DROPZONE based is loaded that stops a 4th option being dropped or swaps that option with one that is already dropped?

Chime in Jacque if that's not what you mean...

Rebecca Fleisch Cordeiro

HI Wendy,

Tx for chiming in. Currently Jacqueline has things set up so that Learners can drag items back and forth. So my interpretation (or misinterpretation ) is that she wants that flexibility, as I mentioned in a previous post. If that's not what she wants, I'd go back to the drawing board and set the whole thing up differently.

So, I'm going to bow out, at least I until we hear back otherwise. Also, have a busy next several days planned, so not entirely sure I'll be able to check in.

Still, don't let me stop you from playing around with other ideas! And tx again for posting.

This discussion is closed. You can start a new discussion or contact Articulate Support.