[CLOSED] NumberField MinValue return null value

  1. #1

    [CLOSED] NumberField MinValue return null value

    Hi,
    When setting the property MinValue = 0, if the value is 0, the value property returns null..
    Here the sample:
    1)Click the button enable field, it's setValue = 0
    2)Click the button ShowValue, it's not show 0 but the value is null.
    So I can not assign a value of 0 which is the minimum value

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ARWebRevolution.WebForm1" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
      
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" >
        </ext:ResourceManager>
        <ext:FormPanel ID="FormPanel1" runat="server" ButtonAlign="Right" Height="185" Padding="5"
            Title="Title" Width="300">  
            <FieldDefaults LabelWidth="90" />
                   <FieldDefaults ReadOnly="true" />                
            <Items>
               <ext:NumberField ID="NumberField1" runat="server" MinValue="0"   >
        </ext:NumberField>
                <ext:TextField ID="TextField1" runat="server" >
                </ext:TextField>
            </Items>
            <Buttons>
                <ext:Button ID="Button1" runat="server" Icon="Disk" Text="Enable Field">
                    <Listeners>
                        <Click Handler="enableField();" />
                    </Listeners>              
                </ext:Button>
                 <ext:Button ID="Button2" runat="server" Icon="Disk" Text="Show Value">
                    <Listeners>
                        <Click Handler="showValue();" />
                    </Listeners>              
                </ext:Button>
            </Buttons>
         
        </ext:FormPanel>
         
        </form>
        <script type="text/javascript" >
     
            function enableField() {
                App.NumberField1.setReadOnly(false);
                App.NumberField1.setValue(0);          
            }
            function showValue() {
                Ext.Msg.show({
                    title: 'Value',
                    msg: App.NumberField1.getValue(),
                    buttons: Ext.Msg.OK,
                    icon: Ext.Msg.QUESTION
                });
            }
     
        </script>
    </body>
    </html>
    Thanks
    Aurelio
    Last edited by Daniil; Mar 22, 2012 at 2:39 PM. Reason: [CLOSED]
  2. #2
    Hi,

    getValue method of NumberField returns a number
    In your case it is 0. Zero means false in 'if' construction in javascript.
    'msg' must be a string

    Try this method
    function showValue() {
                var value = App.NumberField1.getValue();
                Ext.Msg.show({
                    title: 'Value',
                    msg: !Ext.isEmpty(value) ? value.toString() : false,
                    buttons: Ext.Msg.OK,
                    icon: Ext.Msg.QUESTION
                });
            }
  3. #3
    Hi, Vladimir...work ok

    Thanks
    Aurelio

Similar Threads

  1. Replies: 1
    Last Post: Jul 26, 2012, 1:18 PM
  2. Replies: 4
    Last Post: Jul 25, 2012, 5:45 AM
  3. DateTime.MinValue serialized as null
    By nextSTEP in forum 1.x Help
    Replies: 3
    Last Post: Mar 11, 2011, 5:46 PM
  4. [CLOSED] NumberField MinValue Problem
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 28, 2010, 3:04 PM
  5. Replies: 1
    Last Post: Dec 26, 2009, 7:59 AM

Posting Permissions