Topic: drag and drop for other purposes

Hello, I have a question.
I dont want to use the drag and drop function to move or to copy a catchword.
I want to make it possbile that user have the chance to drag a catchword from the tree and to drop it in any html text field.
By dropping a catchword into the text field the name of the catchword should appear in the text field.

Is it possible to do that??

Jonathan

Re: drag and drop for other purposes

for drop to some input

new Mif.Tree.Drag(tree, {
    droppables: [
        new Mif.Tree.Drag.Element(input,{
            onDrop: function(node){
                input.value = node.name
            }
        })
    ]
});

for drop to any input

var dropable = new Mif.Tree.Drag.Element(document.body,{
    onDrop: function(node){
        if(this.where == 'inside'){
            this.target.value = node.name
        }
    }
});
dropable.ondrag = function(event){
    var target = $(event.target);
    if(target.get('tag') != 'input'){
        this.where = 'notAllowed';
    }else{
        this.where = 'inside';
    }
    this.target = target;
    Mif.Tree.Drag.ghost.firstChild.className='mif-tree-ghost-icon mif-tree-ghost-' + this.where;
}
new Mif.Tree.Drag(tree, {
    droppables: [
        dropable
    ]
});