[CLOSED] DateField

  1. #1

    [CLOSED] DateField

    I have a date range that I need to set the END DATE to start at the START DATE only if it is blank. For example dteSessionEndDate should be set to dteSessionStartDate only if blank. This way the END DATE will be in the correct month.


    <ext:CompositeField ID="CompositeField1" runat="server" FieldLabel="Start Date" AnchorHorizontal="100%">
    <Items>
       <ext:DateField ID="dteSessionStartDate" runat="server" Vtype="daterange" DataIndex="SessionSD" Width="90" AllowBlank="false" Format="m/d/yyyy">
          <CustomConfig>
             <ext:ConfigItem Name="endDateField" Value="#{dteSessionStartDate}" Mode="Value" />
          </CustomConfig>
       </ext:DateField>
       <ext:DisplayField ID="DisplayField1" runat="server" Flex="1" Html="&nbsp;" />
    </Items>
    </ext:CompositeField>
    <ext:CompositeField ID="CompositeField2" runat="server" FieldLabel="End Date" AnchorHorizontal="100%">
    <Items>
       <ext:DateField ID="dteSessionEndDate" runat="server" Vtype="daterange" DataIndex="SessionED" Width="90" FieldLabel="End Date" AllowBlank="false" Format="m/d/yyyy">
       </ext:DateField>
       <ext:DisplayField ID="DisplayField2" runat="server" Flex="1" Html="&nbsp;" />
    </Items>
    </ext:CompositeField>
    Last edited by Daniil; Feb 27, 2012 at 10:24 AM. Reason: [CLOSED]
  2. #2
    Hi,

    This is the "daterange" Vtype sources.

    daterange Vtype
    Ext.apply(Ext.form.VTypes, {
        daterange : function (val, field) {
            var date = field.parseDate(val);
     
            if (field.startDateField && (!date  || (!field.dateRangeMax || (date.getTime() !== field.dateRangeMax.getTime())))) {
                var start = Ext.getCmp(field.startDateField);
     
                if (start) {
                    start.setMaxValue(date);
                    field.dateRangeMax = date;
                    start.validate();
                }
            } else if (field.endDateField && (!date || (!field.dateRangeMin || (date.getTime() !== field.dateRangeMin.getTime())))) {
                var end = Ext.getCmp(field.endDateField);
     
                if (end) {
                    end.setMinValue(date);
                    field.dateRangeMin = date;
                    end.validate();
                }
            }
     
            /*
                * Always return true since we're only using this vtype to set the
                * min/max allowed values (these are tested for after the vtype test)
                */
            return true;
        }
    });
    You should be able to apply respective changes.
  3. #3

    Error Message

    I get this error Ext is undefined.
  4. #4
    Please add:
    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    before the script.

Similar Threads

  1. [CLOSED] DateField in ie9 problem
    By pattake in forum 1.x Legacy Premium Help
    Replies: 19
    Last Post: May 24, 2013, 7:49 PM
  2. [CLOSED] DateField Headers
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 13, 2012, 1:05 PM
  3. [CLOSED] V2.0 DateField background
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 16, 2012, 9:58 AM
  4. [CLOSED] How to set Max Year for DateField
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 08, 2011, 8:09 AM
  5. [CLOSED] 0.4.6 : DateField format as dd/mm/yyy
    By stevejebson in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 13, 2008, 3:14 PM

Posting Permissions