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

Rad Numeric Textbox truncates non numeric characters

3 Answers 116 Views
Input
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 10 Aug 2012, 04:55 PM
I have a warehouse application that receives input from a scanner to a Rad Numberic Textbox. The issue I'm having is if the user scans a string like 'GEB34HT3' into the numeric textbox, it will pull the number 343 out of that. This can also be accomplished by copying and pasting into a numeric text box also. Does Rad have any built in controls to avoid this? Thanks,

- Justin 

3 Answers, 1 is accepted

Sort by
0
Evgeniy
Top achievements
Rank 1
answered on 10 Aug 2012, 06:52 PM
Hello, Justin.
As I understand, you get 343  instead of GEB34HT3. Rad Numberic Textbox allows to input numbers only. So you can't type any non number symbol. But I suppose you can use RadTextBox or RadMaskedTextBox for your goals.

All the Best,
Evgeniy
0
Justin
Top achievements
Rank 1
answered on 10 Aug 2012, 07:56 PM
Hey Evgeniy,

     I appreciate the response. I should have clarified that I only want a quantity in the text box and that's why I went with a numeric text box. If a user accidently scans the wrong thing when focus is on the numeric text box (GEB34HT3) it will remove the letters and input the numbers. 343 is not valid because it is an un-intended value. My form auto saves from that point with the wrong data in the quantity field. I want the textbox to reject anything with non numerical characters and not truncate them. Does the Rad Numeric Textbox support anything like that?

- Justin
0
Evgeniy
Top achievements
Rank 1
answered on 14 Aug 2012, 12:08 PM
The best answer on your question can give you telerik team :)
But meantime I can suggest to use javascript for your goals

you can put radnumerictextbox on aspx page
<telerik:RadNumericTextBox ID="txtNumeric" runat="server" onkeyup="NumericCheck();"></telerik:RadNumericTextBox>

and write next code on the same page
<script type="text/javascript">
            function NumericCheck() {
                var txtNumeric = document.getElementById('<%=txtNumeric.ClientID %>');
                var v = txtNumeric.value;
 
                if (!v.match("^[0-9]+$")) {
                    txtNumeric.value = "";
                }
 
            }
</script>

You can use that code as start point to complete your task.
Hope this helps.

All the Best,
Evgeniy 
Tags
Input
Asked by
Justin
Top achievements
Rank 1
Answers by
Evgeniy
Top achievements
Rank 1
Justin
Top achievements
Rank 1
Share this question
or