I have 3 controls 'RadMaskedTextBox': DDI, DDD and TEL
When the user type the DDI, the control must change the focus automatically to the next control (DDD), and so on.
Below is my code
JavaScript
ASPX
VB.NET
htmlfile: Can not move focus to the control because it is invisible, not enabled or of a type that does not accept focus.
Can Someone help me?
Thanks,
Felipe Almeida
When the user type the DDI, the control must change the focus automatically to the next control (DDD), and so on.
Below is my code
JavaScript
function Next(field, max, next) { if (document.getElementById(field).value.length >= max) { document.getElementById(next).focus(); }}ASPX
<telerik:RadMaskedTextBox ID="txtDdiTel" runat="server" Mask="###" PromptChar="_" ResetCaretOnFocus="True" Width="35px" ></telerik:RadMaskedTextBox><asp:Label ID="lblDdiTel" runat="server" Text="-"></asp:Label><telerik:RadMaskedTextBox ID="txtDddTel" runat="server" Mask="###" PromptChar="_" ResetCaretOnFocus="True" Width="35px" ></telerik:RadMaskedTextBox> <asp:Label ID="lblDddTel" runat="server" Text="-"></asp:Label><telerik:RadMaskedTextBox ID="txtTel" runat="server" Mask="####-####" PromptChar="_" ResetCaretOnFocus="True" Width="80px" > </telerik:RadMaskedTextBox>
VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
txtDdiTel.Attributes.Add("onKeyPress", "Next('" & txtDdiTel.ClientID & "', '3', '" & txtDddTel.ClientID & "')")
txtDddTel.Attributes.Add("onKeyPress", "Next('" & txtDddTel.ClientID & "', '3', '" & txtTel.ClientID & "')")
End If
End Sub
But when I type 3 numbers, occurs the following error:htmlfile: Can not move focus to the control because it is invisible, not enabled or of a type that does not accept focus.
Can Someone help me?
Thanks,
Felipe Almeida