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

Copy Paste a special character is accepting in Numeric Textbox

1 Answer 365 Views
Input
This is a migrated thread and some comments may be shown as answers.
Pathrudu
Top achievements
Rank 1
Pathrudu asked on 08 Aug 2013, 08:34 AM
Trying to Copy Paste date format(01/01/2013) is accepting in numeric text box. after moving out of that control it is displaying (01012013). But when i moving out of the control, i need to display a warning message, please enter valid numeric values instead of removing special character.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Aug 2013, 09:18 AM
Hi Pathrudu,

Please check the following code snippet which  restrict user from entering special character in the  RadNumericTextBox.

ASPX:
<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" ClientEvents-OnValueChanging="OnValueChanging">
</telerik:RadNumericTextBox>

JavaScript:
<script type="text/javascript">
    function OnValueChanging(sender, args) {
        var numerictxtbox = document.getElementById('<%=RadNumericTextBox1.ClientID %>');
        var txtboxvalue = numerictxtbox.value;
        if (!txtboxvalue.match("^[0-9]+$")) {
            args.set_cancel(true);
            alert("Please enter valid input!");
        }
    }
</script>

Thanks,
Shinu.
Tags
Input
Asked by
Pathrudu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or