This is a migrated thread and some comments may be shown as answers.

RadMaskedTextBox with Validators cannot be exited

1 Answer 51 Views
Input
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 2
John asked on 28 May 2014, 07:04 PM
I have a form with a number of fields before a RadMaskedTextBox and a number of fields after. In Chrome or Opera, when the focus is placed on the RadMaksedTextBox, the validation must pass, or you cannot tab or click out of the field, which is not the expected behavior. Here is an example exhibiting this behavior.

<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
             <telerik:RadScriptManager ID="RadScriptManager1" AjaxFrameworkMode="Enabled" runat="server" CompositeScript-ScriptMode="Auto" EnableEmbeddedjQuery="False" LoadScriptsBeforeUI="False" OutputCompression="AutoDetect"></telerik:RadScriptManager>
         
             <telerik:RadMaskedTextBox ID="txtSSN4" class="numeric" PromptChar="" SelectionOnFocus="SelectAll" runat="server" Width="44px" MaxLength="4" Mask="####" DisplayMask="****" DisplayText=""
                                                TabIndex="4" meta:resourcekey="txtSSN4Resource1" HideOnBlur="True" AutoCompleteType="Disabled">
                                            </telerik:RadMaskedTextBox
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Text="*" ForeColor="Red"
                                                        ControlToValidate="txtSSN4" ErrorMessage="SSN4 is required." meta:resourcekey="RequiredFieldValidator3Resource1" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator runat="server" meta:resourcekey="SSN4RangeValidatorResource1" ID="SSN4RangeValidator" ForeColor="Red" ControlToValidate="txtSSN4" Text="Format is incorrect." ErrorMessage="SSN4 format is incorrect." ValidationExpression="[0-9]{4}" SetFocusOnError="True"></asp:RegularExpressionValidator>               
            <asp:TextBox runat="server" ID="abc"></asp:TextBox>
        </div>
    </form>
 
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 02 Jun 2014, 08:53 AM
Hello John,

I tested the provided code and it seems that the described behavior is due to the SetFocusOnError property of the Validator controls. Try removing the property or set it to false and the next input should be focused when the Tab key is pressed.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Input
Asked by
John
Top achievements
Rank 2
Answers by
Viktor Tachev
Telerik team
Share this question
or