[CLOSED] DecimalSeparator in NumberField

  1. #1

    [CLOSED] DecimalSeparator in NumberField

    Hi,

    I'm developing a multi-language site. When I work with NumberField in French, the decimal separator is ",". And I must type "," in the keyboard for the decimal number. But in the keyboard, there is a number pad on the right with "." character. In many other application like microsoft excel, it converts automatically "." to "," when I press this button.
    So, my question is: How can I use "," and "." (on the number pad) buttons for decimal separator. And on the screen, it shows only ","?

    Thank you,

    @model dynamic
    
    @{ Layout = null;}
    
    @Html.X().ResourceManager().Locale("fr")
    
    @(Html.X().FormPanel().Title("Test NumberField")
    .Items(i =>
        {
            i.Add(Html.X().NumberField().FieldLabel("Test NumberField"));
        }))
    Last edited by Daniil; Jul 30, 2013 at 4:04 AM. Reason: [CLOSED]
  2. #2
    Hi @UnifyEducation,

    I would try to override a NumberField's filterKeys function.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var myfilterKeys = Ext.Function.createSequence(Ext.form.field.Number.prototype.filterKeys, function (e) {
                var charCode = String.fromCharCode(e.getCharCode());
    
                if (charCode === "." && this.decimalSeparator === ",") {
                    this.setRawValue(this.getRawValue() + ",");
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" Locale="fr" />
    
            <ext:NumberField runat="server">
                <CustomConfig>
                    <ext:ConfigItem Name="filterKeys" Value="myfilterKeys" Mode="Raw" />
                </CustomConfig>
            </ext:NumberField>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Problem with DecimalSeparator
    By Oliver in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 11, 2013, 4:57 PM
  2. Replies: 6
    Last Post: Nov 30, 2012, 4:52 PM
  3. [1.0] Numberfield without decimalSeparator
    By gidi in forum 1.x Help
    Replies: 4
    Last Post: Jul 15, 2010, 1:12 PM
  4. Replies: 0
    Last Post: Sep 29, 2009, 4:42 AM
  5. [CLOSED] NumberField DecimalSeparator issue
    By turione in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 15, 2009, 4:52 PM

Posting Permissions