Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The ondrop event activates when the mouse is released during a drag and drop operation and the element is dropped.  If the Drag and Drop Response screen-level properties are defined, the screen will be submitted automatically.  The operation can be cancelled using the pui.dragDropInfo.cancel flag.  Information about the drag and drop operation is provided using the global pui.dragDropInfo object, which will contain the following properties:

  • dd element - reference to the drag and drop element
  • dd element id - the id of the drag and drop element
  • dd record number - the record number of the subfile record being dragged and dropped when the operation is being performed on a grid element
  • proxy - reference to the drag and drop proxy element; this will be the same as dd element if the "use proxy" property is not set
  • target element - reference to the drop target element
  • target element id - the id of the drop target element
  • target record number - the record number position of where the element was dopped when the target element is a grid
  • event - the browser's event object; this allows you to retrieve information such as mouse position
  • text - text description of the event
  • cancel - flag that defaults to false; can be set to true by custom JavaScript code to cancel the drag and drop operation

Examples:

Increase the count of deleted items shown on the screen when an object is dropped into the trash can.

Code Block
javascript
javascript
if (pui.dragDropInfo["target element id"] == "Trash") {
  changeElementValue("DeletedItems", Number(get("DeletedItems")) + 1);
}

Ask the user to confirm the drag and drop operation:

Code Block
javascript
javascript
if (!confirm("Are you sure?")) {
  pui.dragDropInfo.cancel = true;
}