[CLOSED] DateField with Format always returns minimal date

  1. #1

    [CLOSED] DateField with Format always returns minimal date

    Hi, enter a date and press the button. If the Format is not specified, it returns the correct date.

    What's wrong?

    Thx!

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
    
        private void ButtonSave_Click(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Hi", MyDateField.Text + ", " + MyDateField.SelectedValue).Show();
        }
    
    </script>
    
    <html>
    <head runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:FormPanel runat="server">
            <Items>
                <ext:DateField runat="server" ID="MyDateField" Format="j.n.Y" />
        
                <ext:Button runat="server" Text="Save" ID="ButtonSave" Icon="DatabaseSave">
                    <DirectEvents>
                        <Click OnEvent="ButtonSave_Click" />
                    </DirectEvents>
                </ext:Button>
            </Items>
        </ext:FormPanel>
    </body>
    </html>
    Last edited by Daniil; Mar 27, 2015 at 11:02 AM. Reason: [CLOSED]
  2. #2
    Hi @exe,

    The server side Format property should be set as a .NET date format string, not ExtJS.
  3. #3
    Hi,
    setting format to dd.MM.yyyy is not helping at all. The value returned is stil MinDate.
  4. #4
    I just noticed there is no <form> on the page. In this case a DateField's value is submitted via the FormPanel's API and it uses a DateField's SubmitFormat. So, along with Format, please set SubmitFormat="dd.MM.yyyy" for the DateField.

    Also I would recommend to use a DateField's SelectedDate instead of SelectedValue.
  5. #5
    Thank you! It's working.

Similar Threads

  1. Replies: 5
    Last Post: May 26, 2014, 11:16 AM
  2. Empty NumberField returns minimal value
    By Spamme in forum 2.x Help
    Replies: 5
    Last Post: Jun 06, 2013, 6:48 AM
  3. Date field returns nothing
    By Nime in forum 1.x Help
    Replies: 1
    Last Post: Nov 10, 2009, 8:35 AM
  4. [CLOSED] datefield always returns min value
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 30, 2009, 8:22 AM
  5. [CLOSED] Format date in DateField
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 27, 2009, 12:02 PM

Tags for this Thread

Posting Permissions