Forum Discussion

JenniferMunro-d's avatar
JenniferMunro-d
Community Member
5 months ago

Custom drag and drop issue

Hi all

I've created a custom drag and drop question - to enable partial scoring.

The scoring works well but I'd like to restrict use of the submit button until all options are dropped in target zones.

I created a variable to count dropped items, trigger to change the state of the submit button when the required count is met, and triggers so that if an item is dropped  in the target zone 1 is added to the count and if a an item is dropped back on the source zone 1 is subtracted from the count. However, this doesn't account for movements that are not completed eg if I start to drag an item the source zone to a target zone and subtract one.  And vice-versa.  So, the submit button may never become 'normal'.

Is there a way to do what I need?

I am attaching a mock up file and would appreciate any help.

Jen

  • SamiAwan's avatar
    SamiAwan
    Community Member

    to fix the submit button issue, try using an additional check to see if all items are correctly placed in their target zones. You could add a state to track if items are currently being dragged. Then, only update your count when an item is fully dropped in a target zone or returned to the source zone, not just when it’s moved around.