locked
Populating datetime in calendar control RRS feed

  • Question

  • hi all,

      i want to populate the current datetime in the calendar control when the calendar image in the control is clicked. is there a way to perform this task with a client side script. please advice

     

    thanks

    chris

    Wednesday, December 19, 2007 7:59 AM

Answers

  • hi all,

      below mentioned code will populate the current date and time in the datetime field when the calendar image of that control is clicked.

     

    function OnCrmPageLoad()
    {
    var control = crmForm.all.scheduledendimg;
    control.attachEvent( "onclick" , OnClickImg );

    }

    function OnClickImg()
    {
    var date1= new Date();
    crmForm.all.scheduledend.DataValue=date1 ;
    }

     

    OnCrmPageLoad();

     

      hope this is usefull..

     

    thanks

    Chris

    Monday, March 17, 2008 12:35 PM

All replies

  • hi all,

      Is it possible to populate the current datetime in the calendar field. my requirement is that i want to load the calendar control with the current date and time when the user click the calendar image(date time fields).

     

    thanks

    chris

     

    Wednesday, December 26, 2007 12:35 PM
  • ok.

    If you want to set the date and time for any CRM 3.0 datetime field do the following.

    Code Block

    var oDate;
    var oToday;

    oToday = new Date();
    oDate = oToday;
    oDate = oDate.setHours(17,0,0);

    crmForm.all.scheduledend.DataValue = oDate;

     

    *this code was taken from the crm 3.0 sdk help file*

     

    The date time field's DataValue property reponds to the javascript Date class.

     

    Oshri Cohen
    http://mymscrm3.blogspot.com/
    http://www.linkedin.com/in/oshricohen

    Wednesday, December 26, 2007 9:39 PM
  • thanks for your quick response...

     

    Is it possible to load the current date time when the calendar image is clicked.

     

    thanks

    chris

     

    Thursday, December 27, 2007 6:05 AM
  • You can't customize the onclick event in CRM 3.0 but you can customize the form's onLoad event.



     

    Oshri Cohen
    http://mymscrm3.blogspot.com/
    http://www.linkedin.com/in/oshricohen
    Thursday, December 27, 2007 1:44 PM
  • hi all,

      below mentioned code will populate the current date and time in the datetime field when the calendar image of that control is clicked.

     

    function OnCrmPageLoad()
    {
    var control = crmForm.all.scheduledendimg;
    control.attachEvent( "onclick" , OnClickImg );

    }

    function OnClickImg()
    {
    var date1= new Date();
    crmForm.all.scheduledend.DataValue=date1 ;
    }

     

    OnCrmPageLoad();

     

      hope this is usefull..

     

    thanks

    Chris

    Monday, March 17, 2008 12:35 PM