Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Closed Feature: MaskedEditValidator - when on no entry? [9389]

$
0
0
If using a MaskedEditExtender with untyped mask, without the clearing mask on lost focus the extended textbox will have entry even if the user left it whitout any typing.

MaskedEditExtender:
MaskType=None
Mask=\0\ \8\0\0\ \9999\-9999

I think if the IsValidEmpty flag set to false, the validator should check mask for keyentries, not just check the textbox value property. The mask is not the default value property for that box...

One solution can be:
In MaskedEditValidatorNone function of (MaskedEditValidator.js) to "collect" the prompt characters and compare the count of them to the number of reuqired entries. If they equals the user does not keyed anything to the textbox.

in MaskedEditValidator.cs:
1. Pass the PromptCharacter and the RequiredEntries attributes in OnPreRender routine

a. this.Attributes.Add("PromptChar", MaskExt.PromptCharacter);

string validMask = MaskedEditCommon.GetValidMask(MaskedEditCommon.ConvertMask(MaskExt.Mask));

!!_CharsEditMask constant published!!

Get the keyentry parts of the valid mask by the posible edit keys:
Regex RE = new Regex("["+MaskedEditCommon._CharsEditMask+"]");
b. this.Attributes.Add("RequiredEntries", RE.Matches(validMask).Count.ToString(CultureInfo.InvariantCulture));

2. The First- LastMaskPos retrieved through the MaskedEditCommon class, but I think get~ function's text parameter should be MaskExt.Mask.Replace("\\", ""). The double "\" mustbe removed to get the exact positions in the typed text of the textbox at the client side.

in MaskedEditValidator.js
3. in MaskedEditValidatorNone function setting the mask variable should be moved before the ValidEmpty attribute checking.

Now define regexp object for the PromptChar matching:
a. var RE = new RegExp(value.getAttribute("PromptChar"), "g");
Collect promptChars:
b. var promptChars = mask.match(RE);
Extend the validation check:
c. if (target.value == value.getAttribute("InitialValue") || (promptChars!=null &&
promptChars.length==value.getAttribute("RequiredEntries")))

I hope these can be burned in to the extender's features...
Comments: Issue is closed as not able to produce.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>