1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    9
    Vote Rating
    0
    sandeep9763 is on a distinguished road

      0  

    Default How to set default input type for the Date Field

    How to set default input type for the Date Field


    While i am using the DateField eg:01062001 it will display as 06-jun-2001 ,but i want it to be displayed as 01-jan-2001..It is taking 3rd and 4th as date 1st and 2nd as month ,i need in reverse.

  2. #2
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    364
    Vote Rating
    3
    danguba is on a distinguished road

      0  
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    9
    Vote Rating
    0
    sandeep9763 is on a distinguished road

      0  

    Default


    thnx danguba ,
    In order to do that ,do i need to write the whole dateFiled ? by replacing my own format..

  4. #4
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Antwerp, Belgium
    Posts
    553
    Vote Rating
    25
    joeri has a spectacular aura about joeri has a spectacular aura about

      0  

    Default


    Also look at
    http://dev.sencha.com/deploy/dev/doc...ber=altFormats

    "format" specifies the default format for displaying and input, while altFormats specifies the alternate syntaxes. What you want is to change altFormats so it accepts fields in reversed order. In our app we have a global setting for US / ISO calendar format, and based on this format and altFormats are initialized to appropriate values on Ext.form.DateField.prototype

  5. #5
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Antwerp, Belgium
    Posts
    553
    Vote Rating
    25
    joeri has a spectacular aura about joeri has a spectacular aura about

      0  

    Default


    Here is a simplified version of the script that does our calendar format:
    - startDay: start day for calender picker (starts on sunday for us, starts on monday for iso)
    - format: date format for display (differs)
    - emptyText: empty hint text for date fields
    - altFormats: input formats (the different formats that can be typed in a date field)

    Code:
    <?php
       ...
       $bUseIsoCalendar     = TRUE / FALSE;
       $strCalendarStartDay = ($bUseIsoCalendar ? "1" : "0");
       // n = month with optional leading zeroes; j = day of month with optional leading zeroes 
       $strDateFormat       = ($bUseIsoCalendar ? "d/m/Y" : "m/d/Y");
       $strDateFormatAlt    = ($bUseIsoCalendar ? "j/n/Y|j-n-y|j-n-Y|j/n|j-n|dm|dmy|dmY|d|Y-n-j" : "n/j/Y|n-j-y|n-j-Y|n/j|n-j|md|mdy|mdY|d|Y-n-j");
       $strDateEmpty        = ($bUseIsoCalendar ? "dd/mm/yyyy" : "mm/dd/yyyy");
    ?>
    
    if(Ext.util.Format){
      Ext.util.Format.date = function(v, format){
        if(!v) return "";
        if(!(v instanceof Date)) v = new Date(Date.parse(v));
        return v.dateFormat(format || <?php echo json_encode($strDateFormat); ?>);
      };
    }
    
    if(Ext.DatePicker){
      Ext.apply(Ext.DatePicker.prototype, {
        format            : <?php echo json_encode($strDateFormat); ?>,
        startDay          : <?php echo strval($strCalendarStartDay); ?>
      });
    }
    
    if(Ext.form.DateField){
      Ext.apply(Ext.form.DateField.prototype, {
        emptyText         : <?php echo json_encode($strDateEmpty);?>,
        format            : <?php echo json_encode($strDateFormat); ?>,
        altFormats        : <?php echo json_encode($strDateFormatAlt); ?>,
        startDay          : <?php echo strval($strCalendarStartDay); ?> 
      });
    }

Similar Threads

  1. [FIXED] store's field type input
    By wemerson.januario in forum Ext Designer: Bugs
    Replies: 1
    Last Post: 7 Jul 2010, 4:37 PM
  2. How to set month start date month end date default in date field
    By frank_ash in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 17 Oct 2008, 6:59 AM

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar