2

Closed

MaskedEdit error in "yy/MM/dd" format.

description

The error occurs by the line:2760 of MaskedEditBehaviro.js when MaskedEditExtender is used by the following codes. (When the Button1 is clicked.)

MaskedEditExtender
  • MaskType: Date
  • Mask: 99/99/99 ("yy/MM/dd" format)

aspx code.

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1"
Mask="99/99/99" MaskType="Date">
</cc1:MaskedEditExtender>
<cc1:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender1"
ControlToValidate="TextBox1" InvalidValueMessage="Error!">
</cc1:MaskedEditValidator>

<asp:Button ID="Button1" runat="server" Text="Button" />

MaskedEditBehaviro.js

2729: , AutoFormatDate : function()
2730: {
    ...
2734: var Y4 = (this._maskvalid.indexOf("9999") != -1)?true:false;
    ...
2740: var Dcur,Mcur,Ycur;
2741: if (autocomp == "")
2742: {
2743: var CurDate = new Date();
      ...
2754: if (Y4)
2755: {
2756: Ycur = CurDate.getUTCFullYear().toString();
2757: }
2758: else
2759: {
2760: Ycur = Ycur.substring(2); // Error! : Ycur is undefined.
2761: }

2762: }

So I propose the following changes.

MaskedEditBehaviro.js

Ycur = CurDate.getUTCFullYear().toString();
if (Y4 == false)
{
Ycur = Ycur.substring(2);

}

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

comments

Schneidereith wrote Jan 11, 2008 at 3:45 PM

I'm experiencing the same problem. I have about a dozen MaskedEdit controls each of which breaks when it looses focus causing major development pains. Please fix...
Thank you!