I'm new to Ajax and I'm trying to figure out if I can use the MaskedEditValidator "Validation Expression" in conjunction with the the MaskedEditExtender "Mask". I'm trying to apply the mask(999)999-9999 (which works fine), but at the same time I want to
use the MaskedEditValidator "ValidationExpression" to limit the first character of the area code to 2-9. This does not seem to work. Any help would be greatly appreciated. Here's my code:
Hi - thanks for the reply. I tried the above expression, but I'm still getting an error when I tab out of the textbox. This error is from the "InvalidValueMessage" parameter of the MaskedEditValidator. I'm starting to wonder if the validator is conflicting
with the mask in some way. I'll keep trying and if I figure it out, I will post. Here is my latest (updated) code.
Unfortunately I was not able to get this to work regardless of the ValidationExpression used. The phone mask that I used - (999)999-9999 worked correctly, but when I attempted to use the MaskedEditValidator, the validator always determined that the input
was incorrect even though it was correct. Here is the last code snippet that I used that did not work. It appears as if the parens are the problem. Even if they are escaped, they still prevent the validator from seeing the input as correct. The validator
works fine if there are no parens. Could this be a bug?? If anyone can find anything wrong with this, please post.
<div>Fixed at Change Set 19494</div> <div> </div> <div>Dude, I just downloaded the code and
replaced the files in my MaskedEdit folder in my toolkit, this fix is either not working or I'm missing something here. Can you give us exact instructions on what to do here or recheck your "fix"?</div>
achase111
0 Points
4 Posts
MaskedEditExtender with MaskedEditValidator
Mar 02, 2007 08:21 PM|LINK
Hi Folks,
I'm new to Ajax and I'm trying to figure out if I can use the MaskedEditValidator "Validation Expression" in conjunction with the the MaskedEditExtender "Mask". I'm trying to apply the mask(999)999-9999 (which works fine), but at the same time I want to use the MaskedEditValidator "ValidationExpression" to limit the first character of the area code to 2-9. This does not seem to work. Any help would be greatly appreciated. Here's my code:
<cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server"
TargetControlID="txtClientLookupValue" Mask="(999)999-9999" ClearMaskOnLostFocus="false"></
cc1:MaskedEditExtender><
cc1:MaskedEditValidator ID="MaskedEditValidator1" ControlExtender="MaskedEditExtender1" runat="server" ControlToValidate="txtClientLookupValue" IsValidEmpty="True" ValidationExpression="^[2-9]\d{2}-\d{3}-\d{4}$" Display="Dynamic"></
cc1:MaskedEditValidator>Thank you,
Alan
MaskedEditExtender MaskedEditValidator
FernandoCerq...
Member
240 Points
92 Posts
MVP
Re: MaskedEditExtender with MaskedEditValidator
Mar 03, 2007 02:45 AM|LINK
Hi,
Because the property ClearMaskOnLostFocus="false" No Matches found, Your Regular expression is wrong, try it :
^\([2-9]\d{2}\)\d{3}-\d{4}$
Thanks,
MaskedEditExtender MaskedEdit
MVP ASP.NET Brasil
www.fci.com.br
achase111
0 Points
4 Posts
Re: MaskedEditExtender with MaskedEditValidator
Mar 05, 2007 06:58 PM|LINK
Hi - thanks for the reply. I tried the above expression, but I'm still getting an error when I tab out of the textbox. This error is from the "InvalidValueMessage" parameter of the MaskedEditValidator. I'm starting to wonder if the validator is conflicting with the mask in some way. I'll keep trying and if I figure it out, I will post. Here is my latest (updated) code.
<cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server"
TargetControlID="txtClientLookupValue"
Mask="(999)999-9999"
ClearMaskOnLostFocus="false">
</cc1:MaskedEditExtender>
<%-- Mask="\(???\)???????"--%>
<cc1:MaskedEditValidator ID="MaskedEditValidator1"
ControlExtender="MaskedEditExtender1"
runat="server"
ControlToValidate="txtClientLookupValue"
IsValidEmpty="True"
InvalidValueMessage="INVALID"
ValidationExpression="^\([2-9]\d{2}\)\d{3}-\d{4}$"
Display="Dynamic">
</cc1:MaskedEditValidator>
Thanks,
Alan
MaskedEditExtender MaskedEditValidator
achase111
0 Points
4 Posts
Re: MaskedEditExtender with MaskedEditValidator
Mar 05, 2007 07:32 PM|LINK
PS. The following mask works with no parens. As soon as I add the parens to the mask. I get an error. Having the dash in the mask works fine.
<cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server"
TargetControlID="txtClientLookupValue"
Mask="999999-9999"
ClearMaskOnLostFocus="false">
</cc1:MaskedEditExtender>
<cc1:MaskedEditValidator ID="MaskedEditValidator1"
ControlExtender="MaskedEditExtender1"
runat="server"
ControlToValidate="txtClientLookupValue"
IsValidEmpty="True"
InvalidValueMessage="INVALID"
ValidationExpression="^[2-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]$"
Display="Dynamic">
</cc1:MaskedEditValidator>
achase111
0 Points
4 Posts
Re: MaskedEditExtender with MaskedEditValidator
Mar 06, 2007 03:54 PM|LINK
Unfortunately I was not able to get this to work regardless of the ValidationExpression used. The phone mask that I used - (999)999-9999 worked correctly, but when I attempted to use the MaskedEditValidator, the validator always determined that the input was incorrect even though it was correct. Here is the last code snippet that I used that did not work. It appears as if the parens are the problem. Even if they are escaped, they still prevent the validator from seeing the input as correct. The validator works fine if there are no parens. Could this be a bug?? If anyone can find anything wrong with this, please post.
<
cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtClientLookupValue" Mask="(999)999-9999" ClearMaskOnLostFocus="false"></
cc1:MaskedEditExtender><cc1:MaskedEditValidator ID="MaskedEditValidator1"
ControlExtender="MaskedEditExtender1"
runat="server" ControlToValidate="txtClientLookupValue" IsValidEmpty="True" InvalidValueMessage="INVALID" ValidationExpression="^\([2-9]\d{2}\)\d{3}-\d{4}$" Display="Dynamic"></
cc1:MaskedEditValidator>Thanks,
Alan
FernandoCerq...
Member
240 Points
92 Posts
MVP
Re: MaskedEditExtender with MaskedEditValidator
Mar 07, 2007 04:44 PM|LINK
Hi Alan,
I found the problem. This is a bug [:'(].
Workarround even I to publish the modifications in codeplex :
at change Set (19494)
File MaskedEditValidator.js
---------------------------------------
at lines 80,222, 411, 573 replace
var mask = target.value.substring(parseInt(value.FirstMaskPosition,10),parseInt(value.LastMaskPosition,10));
to
var mask = target.value;
File MaskedEditValidator.cs
-----------------------------------------
replace
ScriptManager.RegisterExpandoAttribute(this, this.ClientID, "ValidationExpression", this.ValidationExpression, false);
to
ScriptManager.RegisterExpandoAttribute(this, this.ClientID, "ValidationExpression", this.ValidationExpression, true);
My Sugestion for Your Mask . You can use in its you mask the filter and not to need the Regular expression , sees below:
<asp:TextBox ID="txtClientLookupValue" runat="server" Width="130px" ValidationGroup="Demo1" />
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender11"
runat="server"
TargetControlID="txtClientLookupValue"
Mask="C99999-9999"
Filtered="23456789"
ClearMaskOnLostFocus="false">
</ajaxToolkit:MaskedEditExtender>
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator11"
ControlExtender="MaskedEditExtender11"
runat="server"
ControlToValidate="txtClientLookupValue"
IsValidEmpty="True"
InvalidValueMessage="INVALID"
Display="Dynamic">
</ajaxToolkit:MaskedEditValidator>
Thanks for you feedback!
MaskedEditExtender MaskedEdit
MVP ASP.NET Brasil
www.fci.com.br
kquinan
Member
2 Points
1 Post
Re: MaskedEditExtender with MaskedEditValidator
May 19, 2007 11:54 PM|LINK
I am having problem to fix the bug, what is the fast and easy way ?
dba123
Contributor
2726 Points
1364 Posts
Re: MaskedEditExtender with MaskedEditValidator
Jul 07, 2007 04:31 AM|LINK
FCerqueira wrote Mar 27 at 1:49 PM
<div>Resolved with changeset 20497. </div>FCerqueira wrote Mar 26 at 9:16 PM
<div>Fixed at Change Set 19494</div> <div> </div> <div>Dude, I just downloaded the code and replaced the files in my MaskedEdit folder in my toolkit, this fix is either not working or I'm missing something here. Can you give us exact instructions on what to do here or recheck your "fix"?</div>dba123
Contributor
2726 Points
1364 Posts
Re: MaskedEditExtender with MaskedEditValidator
Jul 07, 2007 04:43 AM|LINK
That changeset does NOT fix the bug.....
alhambraeido...
Member
132 Points
222 Posts
Re: MaskedEditExtender with MaskedEditValidator
Aug 07, 2007 11:05 AM|LINK
Any solution about it, mister ?
Thanks.
www.kiquenet.com/churrosoft
www.trabajobasura.com/solusoft http://www.setbb.com/putainformatica/viewtopic.php?p=843