views:

123

answers:

0

VS2005, .NET 2.0 Framework

I have a MaskedEditExtender controlling input on a text box to match standard US zipcode. I also have a RegularExpressionValidator validating the entry into the zipcode text box. The submit button will first when the user hits the enter key. if I tab into the textbox,but do not enter any data, the mask is displayed as _-____, which is fine. If I then hit the enter key, the mask disappears, but the validator fails and displays. The validator should not display.

Sean M. Seveson

Here is the markup.

                        <div style="float: left; margin-left: 5px; margin-top: 3px">
                            <asp:RegularExpressionValidator ID="regexZipWCTerritory" runat="server" ControlToValidate="txtZip"
                                Display="Dynamic" ErrorMessage="RegularExpressionValidator" TabIndex="-1" ValidationExpression="(\d{5})?(-\d{4})?"><img src='/SI/Images/warning16.png' alt='Enter a valid Zip Code'/></asp:RegularExpressionValidator></div>
                        <cc2:MaskedEditExtender ID="mskextZipWCTerritory" runat="server" ClearMaskOnLostFocus="true"
                            Filtered="-" Mask="99999-9999" MaskType="None" TargetControlID="txtZip" AutoComplete="False">
                        </cc2:MaskedEditExtender>