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

Replacing . with , ; or insertnig a , from javascript

1 Answer 38 Views
Input
This is a migrated thread and some comments may be shown as answers.
Datamex
Top achievements
Rank 2
Datamex asked on 16 Dec 2009, 01:49 PM
Hi,

I have been having some trouble with the following:

My application has a number of RadNumericTextboxes, in which decimal numbers are entered. My current (and desired) culture settings use a ',' as a decimal separator. My users want to be able to use the '.' on their numeric pad for entering it (much like calc.exe does, it accepts both ',' and '.' and enters a ',').
This does not work with the control and I don't think there is a direct way of setting this option.
If there is an option, please tell me.

As I expect there is no such option, I have written a piece of javascript to handle the OnKeyPress event:
function Dot2Comma(sender, eventArgs) { 
      var c = eventArgs.get_keyCharacter(); 
      if (c == '.') { 
        eventArgs.set_cancel(true); 
        sender.Value = sender.Value + ','; 
      } 
    } 

It goes wrong on the line "sender.Value = sender.Value + ',';" is there any way of adding the ',' from javascript?

Would it be possible to add this functionality in a later version of the telerik radcontrols?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Dec 2009, 02:15 PM
Hi Datamex,

Please use sender._textBoxElement.value instead of sender.Value.
"sender" is the client control instance (not a textbox element) and does not have a "value" property. Consult the control's API if necessary.


Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Datamex
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Share this question
or