2 votes
closed
If I do not set AcceptAMPM to true always get invalid time

Closed Jul 6 2007 at 12:38 AM  by AjaxTK

Comments

most recent at top (show oldest at top)
wrote Jul 6 2007 at 12:38 AM
Resolved with changeset 24400.

wrote Jun 30 2007 at 2:55 AM
Assigning to AjaxTK and changing release to be the next one.

shawnburke wrote Jun 26 2007 at 7:12 AM
Thank you! We'll take a look.

gmorgan wrote Jun 25 2007 at 9:09 AM
Attaching patch for this issue created with the Ajax Control Toolkit Patch Utility....

gmorgan wrote Jun 25 2007 at 7:59 AM
There is a bug in the MaskedEditValidator's EvaluateIsValid() function when 24hr format is used (AcceptAMPM=false). The if statement at line 602 does not take into consideration the AcceptAMPM property, so the AMPM text (which isn't present) is always subtracted from the length used to compare against the time value's length. Adding a check for this property in the if statement solves the problem.

I have modified my MaskedEditValidator class as follows (at line 602):

int tamtext = Target.Text.Length;
if (MaskExt.AcceptAMPM &&
!string.IsNullOrEmpty(CultureAMPMP) &&
(MaskExt.MaskType == MaskedEditType.Time || MaskExt.MaskType == MaskedEditType.DateTime))
{
char[] charSeparators = new char[] { ';' };
string[] ArrAMPM = CultureAMPMP.Split(charSeparators);
if (ArrAMPM[0].Length != 0)
{
tamtext -= (ArrAMPM[0].Length + 1);
}
}
if (MaskedEditCommon.GetValidMask(MaskExt.Mask).Length != tamtext)
{
ok = false;
}


The modified class file is attached. Is it possible to get this modification included in the next release?

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987