Leigh Morresi wrote:

copies some text into [a text box from the] clipboard/buffer than contains a \n 
or \r (line feed or return carriage)...the result is that the user only see's 
the last line of the text they pasted in.

any ideas? ive tried using javascript to catch the event and strip out
the \n's and \r's but onkeydown, onkeyup and onchange dont capture
the event when you past into it


onchange fires only after the text box looses focus. What you need to do is check the the text box while it has focus. A combination of onkeyup and onmousemove might work, but I haven't tested it. It would likely have the disadvantage of not making the change until after the user leaves the field, which could be confusing. A possible solution it polling while the text box has focus using setInterval. How often to poll is a judgment call; below I used 50 milliseconds, or 1/20 of a second.


var txtbox; var intr; var txt;

function setUp() {
txtbox=document.getElementById("txtboxid");
txtbox.onfocus = function(){txt=this;intr = setInterval("checkTextBox(txt)",50);};
txtbox.onblur = function() {clearInterval(intr);};
}


window.onload = setUp;
******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to