Instead of checking for these characters while they are typing or
pasting, why not just replace them with nothing when they submit the
form?

________________________________

From: Asim Manzur [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 3:16 PM
To: CF-Talk
Subject: _javascript_ and textarea


I have form with TextArea  and _javascript_, which doesn't allow
user to hit enter key and "|".

The below code is working fine, but if user cut/paster from word
or notepad then textbox accept the enter key and pipe.

Can someone advise anyway to prevent that??

<script language="_javascript_">
function kH(e) {
var pK = document.all? window.event.keyCode:e.which;
return (pK != 13) && (pK != 124);
}
document.> if (document.layers) document.captureEvents(Event.KEYPRESS);
</script>
<body>
<form name="myForm" action="" method="post"
checkForm();">
<textarea cols="70" class="content" name="story"
rows="5"></textarea>
</form>
________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to