0
votes

My Requirement is that I have to disable the text drag and drop from one textfield to other.However, a manual copy and paste should be allowed.

me.commentsText = Ext.widget('textfield',{          
            maxLength: 40,
            enforceMaxLength:true,
            selectOnFocus : true,
            fieldStyle: {
                 'font': 'normal 13px roboto'
             }
}

enter image description here

Please kindly advise.

1

1 Answers

1
votes

You can prevent Drag and Drop Copy Pasteing by removing the data passed along the drag and drop series of events. However ExtJS doesn't expose these events from the form fields, so you have to grab the Ext.dom.Element for the textfield and attach there. That should give you the option of discarding the data transported via the Drag before it is actually dropped into the new field.

See below for an example:

me.commentsText = Ext.widget('textfield',{          
    maxLength: 40,
    enforceMaxLength:true,
    selectOnFocus : true,
    fieldStyle: {
        'font': 'normal 13px roboto'
    }
});

me.commentsText.getEl().on('drop', function(event) {
    event.preventDefault();
});