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

Pasting comma into Number Input TextBox

3 Answers 440 Views
Input
This is a migrated thread and some comments may be shown as answers.
appdev
Top achievements
Rank 1
appdev asked on 23 Sep 2008, 08:27 AM
Hi,

When I paste the value "12,234" into the Numeric Input box (see below), the control thinks that the comma is a decimal place. This is very confusing for our users, as they have to remove the decimal place. How can I fix this?

Thanks,
Tim

<telerik:RadNumericTextBox ID="txtSalaryTo" runat="server" ShowSpinButtons="true">  
    <NumberFormat DecimalDigits="0" DecimalSeparator="." GroupSeparator="," GroupSizes="3" AllowRounding="false" /> 
    <IncrementSettings Step="1000" /> 
    <ClientEvents OnKeyPress="KeyPress_Salary" /> 
</telerik:RadNumericTextBox> 

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Sep 2008, 08:42 AM
Hello Tim,

You can test this sample approach:
function ValueChanging(sender, args) 
    var newValue = ""
    var oldValue = sender.get_textBoxValue(); 
    var result = oldValue.split(','); 
    for (var i = 0; i < result.length; i++) 
    { 
        newValue += result[i]; 
    } 
    args.set_newValue(newValue); 

<telerik:RadNumericTextBox ID="txtSalaryTo" runat="server" ShowSpinButtons="true"
    <NumberFormat DecimalDigits="0" DecimalSeparator="." GroupSeparator="," GroupSizes="3" 
        AllowRounding="false" /> 
    <IncrementSettings Step="1000" /> 
    <ClientEvents OnKeyPress="KeyPress_Salary" OnValueChanging="ValueChanging" /> 
</telerik:RadNumericTextBox> 

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
George Perley
Top achievements
Rank 1
answered on 22 Mar 2010, 08:28 PM
We are having the same problem as the original poster, and we implemented the solution suggested by Daniel and it works great. However, we use the RadNumericTextBox on a lot of places in our application, and we were hoping to find a more global solution. We put the function in the javascript file that is used for all pages, but that still leaves us with having to edit every RadNumericTextBox control's settings individually.

I tried putting the ClientEvents-OnValueChanging setting into a custom skin, but we get a compile error:

Literal content ('<telerik:RadNumericTextBox ClientEvents-OnValueChanging="ValueChanging" />') is not allowed within a 'skin file'.

Is there a global way to accomplish what we are trying to do here?

George
0
George Perley
Top achievements
Rank 1
answered on 22 Mar 2010, 08:56 PM
After doing a little more research I realized I had left the 'runat="server"' out of the entry in the skin file. That was what was actually causing the error, not the ClientEvents setting itself. Everything works fine now and we have our global solution. Problem solved.

George
Tags
Input
Asked by
appdev
Top achievements
Rank 1
Answers by
Daniel
Telerik team
George Perley
Top achievements
Rank 1
Share this question
or