[CLOSED] How to avoid using Thousand Separator in Coolite Number Field

  1. #1

    [CLOSED] How to avoid using Thousand Separator in Coolite Number Field

    Hi Team:

    i have the following Number Field in my web page. I want to allow the user to enter the numbers 0 to 9, i dont want to allow user to enter "," as thousand separator or "." as decimal separator
    for e.g: 1000 and i dont want user to enter as 1,000.00 How i can achieve this, pls help me...........

     <ext:NumberField AllowNegative="false" AllowDecimals="false" MaxLength="5" MaxText="5" MaxValue="99999" ID="txt_totalCartoon" runat="server" Width="100">
    </ext:NumberField>
    Last edited by Daniil; Dec 02, 2010 at 8:43 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify what version do you use?
  3. #3

    How to avoid using Thousand Separator in Coolite Number Field

    Hi Daniil:

    i am using Coolite 0.8 version.

    Quote Originally Posted by Daniil View Post
    Hi,

    Please clarify what version do you use?
  4. #4
    Hi,

    Confirmed.

    There is a bug in the internal filterKeys() method.

    Please use the following fix, see js code:

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Coolite 0.8.X Example</title>
        <ext:ScriptContainer runat="server" />
    
        <script type="text/javascript">
            Ext.form.TextField.override({
                filterKeys: function(e) {
                    if (e.ctrlKey) {
                        return;
                    }
                    var k = e.getKey();
                    if (Ext.isGecko && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))) {
                        return;
                    }
                    var cc = String.fromCharCode(e.getCharCode());
                    if (!Ext.isGecko && e.isSpecialKey() && !cc) {
                        return;
                    }
                    if (!this.maskRe.test(cc)) {
                        e.stopEvent();
                    }
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:NumberField 
            runat="server" 
            AllowNegative="false" 
            AllowDecimals="false"
            MaxLength="5" 
            MaxValue="99999">
        </ext:NumberField>
        </form>
    </body>
    </html>
  5. #5

    How to avoid using Thousand Separator in Coolite Number Field

    Hi Daniil:

    Thanks, its working... :D:

Similar Threads

  1. [CLOSED] Formatting Number Decimal & thousand seperator
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Mar 30, 2015, 1:06 PM
  2. [CLOSED] Group separator property for number field
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 11, 2012, 4:26 PM
  3. [CLOSED] How to allow thousand separator in ext:NumberField?
    By sailendra in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 07, 2012, 10:35 AM
  4. [CLOSED] blank space as thousand separator
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 19, 2011, 7:04 PM
  5. [CLOSED] Thousand separator in number Field
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 28, 2010, 1:01 PM

Posting Permissions