[CLOSED] NumberField EmptyText

  1. #1

    [CLOSED] NumberField EmptyText

    After migrating from Coolite 0.8.2 version to Coolite 1.0, I have found a problem with property EmptyText on NumberField.

    I would like to set an informative text on the NumberField, but when the user type any value, the text must dissapears (I think that how the emptyText property works).
                            <ext:NumberField runat="server" ID="txtCustomerAccountVoucher"  EmptyText="Voucher Number" AllowDecimals="false"
                                AllowNegative="false"  AllowBlank="false"
                                Title="<%$ Resources: txtCustomerAccountVoucher.Title %>">
                            </ext:NumberField>
    After the migration, the text "-1,7976931348623157e+308" is shown instead of "Voucher Number". Also, the value of the NumberField is not recover correctly in this situation.

    I have test using BlankText instead of Empty Text, no error is shown but no informative text is not shown.

    Could you please told me what I am doing wrong?
    Last edited by geoffrey.mcgill; Oct 27, 2010 at 7:30 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Here are links to the docs records of emptyText and blankText properties (ExtJS docs).
    http://dev.sencha.com/deploy/dev/doc...mber=blankText
    http://dev.sencha.com/deploy/dev/doc...mber=emptyText

    If I understood you properly you should use the EmptyText property in according to your requirement.
    But take care because of
    Note: that this value will be submitted to the server if this field is enabled and configured with a name.
    So, in this case a value "Voucher Number" will be submitted.
    After the migration, the text "-1,7976931348623157e+308" is shown instead of "Voucher Number". Also, the value of the NumberField is not recover correctly in this situation.
    Please clarify how can we reproduce it?
    Could you provide a sample code like the following one?

    Example
    <%@ Page Language="C#" %>
    
    <%@ 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 runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:NumberField runat="server" EmptyText="Empty text" />
        </form>
    </body>
    </html>
  3. #3
    I adjust you my code


    Aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PruebaBorrar.aspx.cs" Inherits="Acris.Web.Reservations.PruebaBorrar"
        EnableViewState="false" %>
    
    <%@ 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">
    <%@ Import Namespace="Ext.Net.Utilities" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
        <!-- Estilos -->
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="mask" style="display: none">
        </div>
        <ext:ResourceManager ID="ResourceManager1" runat="server" StateProvider="None" />
        <!-- Contenido -->
        <ext:Viewport ID="Viewport1" runat="server">
            <Content>
                <table>
                    <tr>
                        <td>
                            <ext:NumberField ID="nfVoucherNumber" runat="server" AllowBlank="true" AllowDecimals="false"
                                AllowNegative="false" DecimalPrecision="0" EmptyText="Number of the voucher" />
                        </td>
                    </tr>
                </table>
                <ext:Button ID="btnSearch" runat="server" Text="Search" AutoPostBack="false">
                    <DirectEvents>
                        <Click OnEvent="btnSearch_OnClick" Buffer="250">
                            <EventMask ShowMask="true" Msg="" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Content>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Codebehind:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    namespace Acris.Web.Reservations
    {
        public partial class PruebaBorrar : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
            protected void btnSearch_OnClick(object sender, DirectEventArgs e)
            {
                if (!nfVoucherNumber.IsEmpty)
                {
                    //A Voucher Number has been typed
                }
                else
                {
                    //none Voucher Number has been typed
                }
            }
        }
    }
    If I click on button "btnSearch" without insert any value on the numberField "nfVoucherNumber":

    nfVoucherNumber.Value = -1.7976931348623157E+308
    nfVoucherNumber.IsEmpty = false.
    What i would like is a similar behaviour that when you use the EmptyText on a TriggerField, that is, this value doesn't affect to the TriggerField.Value. In my example, what i would like is to be able to detect if the user has typed a value on the numberField.

    Thank you!
    Last edited by geoffrey.mcgill; Oct 25, 2010 at 8:54 PM. Reason: please use [CODE] tags
  4. #4
    Hi,

    Thanks we fixed it. We are moving SVN repository to the new area therefore I cannot commit at this moment. I will notify when all will be done

    At this moment you can add the following code to the NumberFieldBase.cs file in your local repository
    /// <summary>
            /// The fields null value.
            /// </summary>
            [Meta]
            [Category("5. Field")]
            [Description("The fields null value.")]
            public override object EmptyValue
            {
                get
                {
                    object obj = this.ViewState["EmptyValue"];
                    return (obj == null) ? double.MinValue : obj;
                }
                set
                {
                    this.ViewState["EmptyValue"] = value;
                }
            }
  5. #5
    This fix has been committed to the new SVN location at:

    http://svn.ext.net/premium/trunk/

    Please see http://forums.ext.net/showthread.php?10672#post44029 for more information on relocating SVN.
    Last edited by geoffrey.mcgill; Nov 08, 2010 at 7:03 PM.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] How to keep the EmptyText item in the ComboBox?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 31, 2012, 2:22 PM
  2. [CLOSED] Change the syle of EmptyText
    By RCN in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 04, 2012, 7:25 PM
  3. [CLOSED] Syntax to set EmptyText
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Jan 24, 2011, 6:48 PM
  4. [CLOSED] [1.0] - SpinnerField - EmptyText issues.
    By drkoh in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 26, 2010, 9:58 AM
  5. [1.0] Field EmptyText
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 11, 2010, 3:47 PM

Tags for this Thread

Posting Permissions