6

Closed

MaskedEdit Extender with custom date type mask gives javascript error

description

I have defined the maskededit control as such. It validates invalid dates ok on the server side, but everytime a valid date is entered in the textbox, and cursor leaves the textbox, I get a javascript error. The mask differs from the default en-US culture only by specifying a 2 digit year as opposed to a 4 digit year.
    <ajaxToolkit:MaskedEditExtender ID="medtDueDate" runat="server"
                    TargetControlID="txtDueDate" Century="2000"
                    Mask="99/99/99"
                    MaskType="Date"
                    DisplayMoney="None"
                    AcceptNegative="None"/>
The error I narrowed down to this code in scriptresource.axd file...

Error: Ycur has no properties
Source file: https://cafedevelop/IR/ScriptResource.axd?d=pdVRyRDcv1LicjmdE8JGmCsxdyl9TtuiSAy6fYA221Tua6iQH0LdMal0uLptytjPRmOhOMIlJiUfa0Bd08Nzqclahzv80o1_KZDUngfLfGQ1&t=633259125600000000
Line: 1510

The following is the code snippet where the error is occurring...

var Dcur,Mcur,Ycur;if (autocomp == "")
{
var CurDate = new Date();Dcur = (CurDate.getUTCDate()).toString();if (Dcur.length < 2)
{
Dcur = "0" + Dcur;}
Mcur = (CurDate.getUTCMonth()+1).toString();if (Mcur.length < 2)
{
Mcur = "0" + Mcur;}
if (Y4)
{
Ycur = CurDate.getUTCFullYear().toString();}
else
{
Ycur = Ycur.substring(2);} //This is line 1510 where the error occurs.

The way I read this code, YCur is only set if the "if(Y4)" condition evaluates to true, but my code fails in the else where YCur has not been initialized at all. Seems to me this is a bug, unless someone can explain otherwise. By the way, I am using the latest release of the toolkit (10920).

Thanks,

Mark
Closed May 3, 2013 at 7:09 AM by Superexpert
Issues is closed as it is fixed with April 2013 release.

comments

Yarosh wrote Mar 20, 2008 at 11:28 AM

How I can input Date like MM/dd/yy ?

Year - only two digits !!!
It's important