Skip to main content
Inspiring
June 27, 2017
Answered

Drag-drop redraggable - adv action fires on click

  • June 27, 2017
  • 2 replies
  • 260 views

I'm creating a drag - drop with an advanced action (object action) counting dropped items that fires when an item is dropped. I also want users to be able to re-drag a mistakenly dropped item to its correct drop zone without sending it back to origin with Undo. My AA calls a javascript that determines correct drops and scoring according to a set of rules. All works fine except that my AA is triggered by simply clicking a dropped item once it is in a drop zone - it does not have to be dragged anywhere. This allows users to run up the counter by repeatedly (and infinitely) clicking one correctly dropped item.

Is there any way to limit firing of the AA to actually dropping an item into a drop zone when redrag is enabled?

The javascript is irrelevant to this issue - just an AA that increments a counter has the same problem.

Thanks for your help.

CP9.0.2.437

    This topic has been closed for replies.
    Correct answer Lilybiri

    You should have posted the advanced action. Avoiding this can be done by not using a unique counter that is incremented, but a different variable for each correct drag action that is toggled from 0 to 1. Once the variable is set to 1, it cannot be incremented. The real counter can always be calculated by summing up the boolean variables, or you can rethink the conditional action.

    2 replies

    dan561Author
    Inspiring
    June 28, 2017

    Thank you for the suggestion of using booleans - that does the trick. Only a few more variables to add to the system and a condition to do nothing if an item is already in the same drop zone as it was before and everything works like a charm.

    You're the best!

    PS - I didn't post the AA because it's trivial, but here it is anyway.

    The javascript hits a clickbox that then totals everything up, shows warnings, etc. Now it looks like the following:

    Lilybiri
    LilybiriCorrect answer
    Legend
    June 27, 2017

    You should have posted the advanced action. Avoiding this can be done by not using a unique counter that is incremented, but a different variable for each correct drag action that is toggled from 0 to 1. Once the variable is set to 1, it cannot be incremented. The real counter can always be calculated by summing up the boolean variables, or you can rethink the conditional action.