[CLOSED] DateField replacing the "today" link with a different title and different date

  1. #1

    [CLOSED] DateField replacing the "today" link with a different title and different date

    Is there a way to either replace the "today" link with a different date and title, such as "Inception" and a custom date (date other than current day)? In addition can I add a custom link button, so you'd have "today" and "Inception" linking to two different dates.

    Last edited by Daniil; Dec 16, 2011 at 6:38 PM. Reason: [CLOSED]
  2. #2

    Please clarify do you mean the "month + year + arrow down" at the top of DatePicker?
  3. #3
    They link/button at the bottom of the control with label "Today". See attached image.
    Attached Thumbnails Click image for larger version. 

Name:	datefielde.JPG 
Views:	71 
Size:	18.5 KB 
ID:	3567  
  4. #4
    Quote Originally Posted by rmelancon View Post
    They link/button at the bottom of the control with label "Today". See attached image.
    You can set the .TodayText property of the DatePicker.
    Last edited by geoffrey.mcgill; Dec 12, 2011 at 6:33 PM.
    Geoffrey McGill
  5. #5
    I understand the .TodayText will change the text but it will still fill in today's date when clicked. What I need is (for example) to change the text to "Tomorrow" and when clicked it will fill in tomorrows date.
  6. #6
    I can suggest the following solution.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:DateField runat="server" TodayText="Tomorrow">
                    <BeforeRender Handler="this.onTriggerClick = this.onTriggerClick.createSequence(function () {
                                                if (!this.wasTriggerClick) {
                                                    var btn = this.menu.picker.todayBtn;
                                                    btn.handler = function () {
                                                        this.setValue(new Date().add(Date.DAY, 1).clearTime());
                                                        this.fireEvent('select', this, this.value);
                                                    this.wasTriggerClick = true;
                                           });" />
  7. #7
    Thanks, that seems to work. The only problem I'm having is that after clicking the newly labled, etc. "Today" button, it becomes disabled. It doesn't do that in your simple example so it's something else in my implementation and surrounding code. Is that button somehow tied to min max values? What could be disabling that button after being clicked?
  8. #8
    I think it happens in the update method of DatePicker.

    There is the following piece of code:
        var td = new Date().clearTime(),
            disable = (td < min || td > max ||
            (ddMatch && format && ddMatch.test(td.dateFormat(format))) ||
            (ddays && ddays.indexOf(td.getDay()) != -1));
            this.todayKeyListener[disable ? 'disable' : 'enable']();
    Generally, I would suggest you to implement your custom control inheriting from DateField which would use your custom JavaScript DateField class. That custom JavaScript class should use your custom JavaScript DatePicker class where you should implement the "tomorrow" logic that you need.

Similar Threads

  1. [CLOSED] Is there any way to "disable" the FieldSet title label?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 31, 2012, 8:47 PM
  2. [CLOSED] Default date format for Type="Date" RecordField
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: May 29, 2012, 3:16 PM
  3. Replies: 4
    Last Post: May 22, 2012, 10:40 AM
  4. Replies: 0
    Last Post: Nov 07, 2011, 6:53 PM
  5. Replies: 1
    Last Post: Jul 11, 2011, 7:03 PM

Posting Permissions