-
18 Jan 2011 1:27 AM #1
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.
-
18 Jan 2011 2:11 AM #2All 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
-
18 Jan 2011 2:33 AM #3
thnx danguba ,
In order to do that ,do i need to write the whole dateFiled ? by replacing my own format..
-
18 Jan 2011 2:35 AM #4
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
-
18 Jan 2011 4:56 AM #5
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
-
[FIXED] store's field type input
By wemerson.januario in forum Ext Designer: BugsReplies: 1Last Post: 7 Jul 2010, 4:37 PM -
How to set month start date month end date default in date field
By frank_ash in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 17 Oct 2008, 6:59 AM


Reply With Quote

