[CLOSED] How to a apply Format to a number field in a Form?

  1. #1

    [CLOSED] How to a apply Format to a number field in a Form?

    Hi,

    I have a Form with the NumberField "NUMBEROFSEATSAUTHORIZEDField", I need to apply a number Format to this field, but it does not have the Format property.

    How can I apply the Format to a field in a Form like in a Grid for "NumberColum".

    // Example Form field
    <Anchors>
        <ext:Anchor Horizontal="80%">
            <ext:NumberField 
                ID="NUMBEROFSEATSAUTHORIZEDField"
                runat="server" 
                FieldLabel="Seats Authorizied"
                AllowBlank="false"
                />
        </ext:Anchor>
    </Anchors>
    
    // Example Grid NumberColumn
    <ext:NumberColumn 
        DataIndex="NUMBEROFSEATSUSED" 
        Width="100"
        Header="Seats Used" 
        Format="0.000/i"
        />
  2. #2

    RE: [CLOSED] How to a apply Format to a number field in a Form?

    Hi,

    NumberField doesn't support formating. Use TextField (formating will be applied on blur)

    <ext:TextField ID="TextField1" runat="server" MaskRe="/[0-9\-\,\.]/">
        <Listeners>
            <Change Handler="this.setValue(Ext.util.Format.number(newValue.replace(/[\,\.]/g, ''), '0.000/i'));" />
        </Listeners>
    </ext:TextField>
  3. #3

    RE: [CLOSED] How to a apply Format to a number field in a Form?

    I applied the listener to the textField, but it does not show the value with the format when the record is loaded.

    <Anchors>
        <ext:Anchor Horizontal="80%">
            <ext:TextField 
                ID="NUMBEROFSEATSAUTHORIZEDField"
                runat="server" 
                FieldLabel="Seats Authorizied"
                AllowBlank="false" 
                ReadOnly="true">
                <Listeners>
                    <Change Handler="this.setValue(Ext.util.Format.number(newValue.replace(/[\,\.]/g, ''), '0.000/i'));" />
                </Listeners>
            </ext:TextField>
        </ext:Anchor>
    </Anchors>
  4. #4

    RE: [CLOSED] How to a apply Format to a number field in a Form?

    Can you just format the number server-side before setting the .Text property of the <ext:TextField>?

    Geoffrey McGill
    Founder

Similar Threads

  1. FORMAT NUMBER ON A GRIDPANEL
    By marcmvc in forum 1.x Help
    Replies: 2
    Last Post: Feb 21, 2011, 9:23 AM
  2. [CLOSED] Number Format
    By majestic in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 23, 2011, 3:57 AM
  3. Replies: 0
    Last Post: Dec 02, 2010, 9:01 PM
  4. How to format a number with 3 decimal
    By NishaLijo in forum 1.x Help
    Replies: 1
    Last Post: Nov 24, 2010, 5:44 AM
  5. [CLOSED] How to format a decimal number...
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: May 26, 2009, 3:48 AM

Posting Permissions