Solved
Help with validating length of data entered
Posted on 2013-01-07
Hello,
I am usin the code below to make sure users enter all data in MaskedInput control, but when the user enters only one number a the end, for example ___,___9, the "Invalid" error message does not trigger. How do i fix this problem?
function C1RotationMin_OnClientBlur(sender, e) {
var mskinput = $find('<%=C1RotationMin.ClientID %>');
var txb = $('#C1RotationMin_C1TextBox');
if (mskinput.get_text().trimEnd().length < 6 && mskinput.get_text().trimEnd().length > 0) {
alert("Invalid");
document.focus();
mskinput.focus();
}
};
<td class="style40" bgcolor="Silver" >
<cc2:C1MaskedInput ID="C1RotationMin" runat="server" Mask="999,999"
Width="50px" style="top: 0px; left: 0px" OnClientBlur="C1RotationMin_OnClientBlur" OnClientFocus="C1RotationMin_OnClientFocus"/>
</td>
Thanks,
Victor