tags:

views:

8

answers:

2

I have a Tab Delimited Data lets say Name Address DOB EmailID copied to clipboard, now I need to paste this data on some online html forms which contains these fields,but whenever I am trying to do so its pasting all the contents in selected text box, where as if I try the same in excel its recognizing the tabs and placing each filed properly in a different cell.

Do I need to format my input data some other way, please let me know.

A: 

It's a little bit difficult to tell when someone pastes data into a field. I believe that only IE and Safari support the onpaste event [source]. For everyone else, you could just check the keypress event.

Anyway, if you can find an appropriate event to latch onto, just check the value of the element, and if it contains tab characters, split the value on that and populate the remaining fields.

document.getElementById('first_field').onpaste = function() {
    var cells = this.value.split('\t');
    if (cells.length > 1) {
        // loop through 'cells' and put the value into the other fields
    }
};
nickf
A: 

I'm not sure this is possible without a bit of programming (creating html forms to post), I wouldn't normally recommend it but if you are not familiar with any programming constructs you might want to check out autohotkey, you might be able to get it to mimic your copy and paste action. If you want a real solution, just holler.

Orbit