[CLOSED] Troubles with some Textfield

  1. #1

    [CLOSED] Troubles with some Textfield

    Hi,

    I was testing number formatting with Textfield and the page i was testing is now displaying absolutely nothing.
    Here is the code:

    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>
        <div>
         Champ test: <ext:TextField ID="TextField1" runat="server" MaskRe="=/[0-9\.]/">
                  <Change Handler="this.setValue(Ext.util.Format.number(newValue.replace(/[\$]/g, ''), '0,0.00'));" />
             </ext:TextField>
        </div>
            <div>
               Champ asp: <asp:TextBox ID="test" runat="server"></asp:TextBox>
            </div>
        </form>
    </body>
    </html>
    Moreover before it started displaying nothing, the formating was not working at all !
    Last edited by Daniil; Nov 27, 2013 at 9:17 AM. Reason: [CLOSED]
  2. #2
    Hello!

    You need to use buffer value. You can read more about it here: http://www.ext.net/2012/12/19/introd...xt-net-events/

    Try the following one:

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" SourceFormatting="true" ScriptMode="Debug" />
    
            <div>
             Champ test: 
                 <ext:TextField ID="TextField1" runat="server" MaskRe="/[0-9\.]/">
                        <Listeners>
                            <Change Handler="this.setRawValue(Ext.util.Format.number(newValue.replace(/[\$]/g, ''), '0,0.00')); " Buffer="500" />
                        </Listeners>
                 </ext:TextField>
            </div>
        </form>    
    </body>
    </html>
  3. #3
    Hi Baidaly,

    It works almost as i get strange results when i try to edit the value in the field.
    For example if i enter 123456789 i get 123.456.789,00 however when i try to edit the field to remove 9 for example, the field is emptied.
    Is it normal ?
  4. #4
    OK, I'd use another approach with Focus and Blur:

    <%@ Page Language="C#" %>
     
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
     
    <!DOCTYPE html>
     
    <html>
    <head id="Head1" runat="server">
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
     
            <div>
             Champ test: 
                 <ext:TextField ID="TextField1" runat="server" MaskRe="/[0-9\.]/">
                        <Listeners>
                            <Blur Handler="
                                this._value = this.getValue(); 
                                this.setValue(Ext.util.Format.number(this.getValue().replace(/[\$]/g, ''), '0,0.00')); " />
                            <Focus Handler="
                                if (this._value != undefined)
                                    this.setValue(this._value); " />
                        </Listeners>
                 </ext:TextField>
            </div>
        </form>    
    </body>
    </html>
  5. #5
    Thanks Baidali, now it works flawlessly.
    Thanks again and take care.

Similar Threads

  1. Replies: 6
    Last Post: Jun 28, 2013, 6:58 AM
  2. Troubles with Javascript during rendering
    By Paul D in forum 1.x Help
    Replies: 2
    Last Post: Nov 08, 2010, 11:15 AM
  3. [CLOSED] Help with some troubles
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 09, 2010, 3:36 PM
  4. [CLOSED] Troubles with resources and WebMethods (ASMX)
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 27, 2010, 11:29 AM
  5. [CLOSED] [0.8.2] Notifications and js troubles.
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 20, 2010, 4:51 AM

Posting Permissions