View Full Version : paste problems in textbox

10-27-2006, 08:29 AM
I recently came across a Javascript date validation script (http://javascript.internet.com/forms/format-date.html).

However when you try and paste a date into the field it cuts of the last 2 characters on the end. The onKey event for the field reacts to the Ctrl+V as 2 invalid characters being submitted to the script and strips the last two characters off.

Any ideas of a workaround?

Philip M
10-27-2006, 09:08 AM
Try this (kludge??):-

<input type="text" name="testDateFormat1" size='10' maxlength="12" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">

and the same in the two other input boxes.
But I have only tested this roughly.

10-27-2006, 02:39 PM
The problem is that the max length needs to be 10.