Hi,
My issue and code here:
I have a telerik RadNumeric Text Box and a button. When i enter 6 digit number in the text box, it should auto tab to button.
I am using "OnKeyUp" to achieve this. The first time i type in the 6 digits into the text box, it auto tabs to the button. After that, if i go back to the text box to enter a new number, after entering a single digit, it auto tabs out. It does not wait till i enter 6 digits to tab out.
I can't figure out why it is tabbing out after entering a single digit.
NOTE: When i load the page the first time, it works good. It tabs out after entering 6 digits. Every subsequent attempt to enter a number in that text box, it tabs out after single digit.(No new page load involved). Why is it tabbing out after entering single digit
<
telerik:RadNumericTextBox
ID
=
"txtClientIDSelect"
Runat
=
"server"
AutoPostBack
=
"false"
DataType
=
"System.Int32"
ValidationGroup
=
"Submit"
OnTextChanged
=
"txtClientIDSelect_TextChanged"
MaxLength
=
"6"
Width
=
"50px"
onkeyup
=
"NumericValue1KeyDown(this,event)"
>
<
NumberFormat
ZeroPattern
=
"n"
AllowRounding
=
"False"
DecimalDigits
=
"0"
DecimalSeparator
=
"#"
GroupSeparator
=
""
GroupSizes
=
"6"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"reqClientID"
runat
=
"server"
ControlToValidate
=
"txtClientIDSelect"
ValidationGroup
=
"Submit"
ErrorMessage
=
"ClientID is required."
ToolTip
=
"ClientID is required."
InitialValue
=
"--Select--"
SetFocusOnError
=
"True"
>*</
asp:RequiredFieldValidator
>
<%-- <
asp:TextBox
ID
=
"txtClientIDSelect"
runat
=
"server"
></
asp:TextBox
>--%>
<
asp:Button
ID
=
"btnSubmitClient"
runat
=
"server"
Text
=
"SUBMIT"
ValidationGroup
=
"Submit"
onclick
=
"btnSubmitClient_Click"
/>
<
script
type
=
"text/javascript"
>
function NumericValue1KeyDown(sender, e) {
var key = e.keyCode;
var textCount = 0;
textCount = document.getElementById('<%= txtClientIDSelect.ClientID %>').value
//setTimeout(function() { }, 200);
if(textCount.length >= 6)
{
document.getElementById('<%=btnSubmitClient.ClientID %>').disabled = false ;
document.getElementById('<%=btnSubmitClient.ClientID %>').focus();
}
}
</
script
>