Method 1:
// Custom vtype, validation date Selection Range Ext. Apply (ext. Form. Field. vtypes ,{ // Verification Method Daterange: function (Val, field) {var begindate = Null , // Start date Begindatecmp = Null , // Start date component Enddate = Null , // End date Enddatecmp = Null , // End date component Validstatus = True ; // Verify the status If (Field. daterange ){ // Obtain the start time If (! Ext. isempty (field. daterange. Begin) {begindatecmp = ext. getcmp (field. daterange. Begin); begindate = begindatecmp. getvalue ();} // Obtain the end time If (! Ext. isempty (field. daterange. End) {enddatecmp = ext. getcmp (field. daterange. End); enddate = enddatecmp. getvalue ();}} // If one of the seemingly time or end time is null, it passes verification. If (! Ext. isempty (begindate )&&! Ext. isempty (enddate) {validstatus = begindate <= enddate ;} Return Validstatus ;}, // Verification prompt information Daterangetext: 'Start time cannot be later than end time' }); // Use: {ID: 'Begindate' , Fieldlabel: 'Admission start date' , Daterange: {begin: 'Begindate' , End: 'Enddate' }, // Used for vtype daterange Vtype: 'Daterange' }, {ID: 'Enddate' , Fieldlabel: 'Admission end date' , Daterange: {begin: 'Begindate' , End: 'Enddate' }, // Used for vtype daterange Vtype: 'Daterange' }
Method 2:// Set the maximum and minimum values of datefield through the listenerListeners :{'Focal': Function (e) {var endtime = ext. getcmp ('Endtimeid'). Getvalue ();If(Endtime! =''){This. Setmaxvalue (endtime. Format ('Y-m-d'));}}}