# Javascript function for rejectinga drag source

**URL:** <https://talk.atomisystems.com/t/javascript-function-for-rejectinga-drag-source/5382>\
**Category:** Support Questions\
**Created:** [July 2, 2021, 11:16am UTC](https://talk.atomisystems.com/t/javascript-function-for-rejectinga-drag-source/5382 "2021-07-02T11:16:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nukubi](https://talk.atomisystems.com/user_avatar/talk.atomisystems.com/nukubi/32/2810_2.png) [@Nukubi](https://talk.atomisystems.com/u/Nukubi)\
**Post date:** [July 2, 2021, 11:16am UTC](https://talk.atomisystems.com/t/javascript-function-for-rejectinga-drag-source/5382/1 "2021-07-02T11:16:33Z")

</div>

> **Summary**
>
> I was wondering if there was any way to have a drop target reject a drag source, using javascript. I am aware of how to do this without javascript, but using javascript will make the program more fleixible.  
> Thank you

---

<div class="post-metadata">

**Author:** ![ToanLS](https://talk.atomisystems.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@ToanLS](https://talk.atomisystems.com/u/ToanLS)\
**Post date:** [July 5, 2021, 3:52am UTC](https://talk.atomisystems.com/t/javascript-function-for-rejectinga-drag-source/5382/2 "2021-07-05T03:52:31Z")

</div>

Hi,

If the drag source is already dropped into the drop target, you can use `dropTargetObject.dropHelper.startDragOut(dragSourceObject)`.  
For example, in `On Accept` event of the drop target:

```javascript
// the drag source has been dropped
var droppedSource = e.value;
// reject if its name is reject_me
// this in On Accept is the drop target object
if (droppedSource.name() == 'reject_me')
    this.dropHelper.startDragOut(droppedSource);

```

Regards
