Click here to Skip to main content
15,888,454 members
Home / Discussions / JavaScript
   

JavaScript

 
Question[RESOLVED] innerHTML messed up Pin
CodingLover27-Apr-11 18:58
CodingLover27-Apr-11 18:58 
AnswerRe: innerHTML messed up Pin
AspDotNetDev27-Apr-11 19:43
protectorAspDotNetDev27-Apr-11 19:43 
GeneralRe: innerHTML messed up Pin
CodingLover27-Apr-11 21:09
CodingLover27-Apr-11 21:09 
AnswerRe: innerHTML messed up Pin
Gerben Jongerius27-Apr-11 20:53
Gerben Jongerius27-Apr-11 20:53 
GeneralRe: innerHTML messed up Pin
CodingLover27-Apr-11 21:11
CodingLover27-Apr-11 21:11 
GeneralRe: innerHTML messed up Pin
Gerben Jongerius27-Apr-11 21:47
Gerben Jongerius27-Apr-11 21:47 
GeneralRe: innerHTML messed up Pin
CodingLover27-Apr-11 23:11
CodingLover27-Apr-11 23:11 
QuestionDynamics CRM 2011 - Cutomizing datetime picker in CRM Form [SOLVED] Pin
phil.o27-Apr-11 4:55
professionalphil.o27-Apr-11 4:55 
Hi,

I'm starting to test the new Dynamics CRM 2011 ; i'd like to figure out whether it could be useful for our needs.
I'm facing a problem since a couple of days : in the previous version, I could customize the time-pickers to show different time interval (default is 30 minutes).
But I can't find the right syntax for the 2011 version.

Here's my script :

var schedstart = Xrm.Page.getAttribute("scheduledstart");
var interval = 15;
var timeField;
var tables;
var table;
var row;
var cell;
var time;

if (schedstart != null)
{
   timeField = schedstart.all.time;

   //Check the existence of the time field. It is null if the control is setup to only display the date.
   if (timeField != null)
   {
      //The new interval in minutes.
      tables = timeField.getElementsByTagName("table");

      if ((tables != null) && (tables.length > 0))
      {
         table = tables[1];

         //Remove all existing values from the selection box
         while (table.firstChild != null)
         {
            table.removeChild(table.firstChild);
         }

         //Add the new values
         for (hour = 0; hour < 24; hour++)
         {
            for (min = 0; min < 60; min += interval)
            {
               row = table.insertRow();
               cell = row.insertCell();
               time = ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
               cell.setAttribute("val", time);
               cell.innerText = time;
            }
         }
      }
   }
}


The problem is on line timeField = schedstart.all.time;. I've been searching for a reference document about manipulating form elements, but none of them does talk about datetime fields. I got plenty of examples if I want to deal whith lookups, optionsets, text, etc. ; but complete blackout about datetime fields.

Does anyone have an idea about how to access the time-picker of a datetime field in javascript ?

Edit :
I found how to manage this requirement. Here's the code :

setTimeInterval: function (ctrl, interval)
{
   var control = Xrm.Page.getControl(ctrl);
   var timeField = control._control._element.children[0].children[1].all.time.children[1].firstChild;
   var row;
   var cell;
   var time;

   if (timeField != null)
   {
      while (timeField.firstChild != null)
         timeField.removeChild(timeField.firstChild);

      for (hour = 0; hour < 24; hour++)
      {
         for (min = 0; min < 60; min += interval)
         {
            row = timeField.insertRow();
            cell = row.insertCell();
            time = ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
            cell.setAttribute("val", time);
            cell.innerText = time;
         }
      }
   }
}


Hope this will be useful to someone Wink | ;)
AnswerRe: Dynamics CRM 2011 - Cutomizing datetime picker in CRM Form Pin
Graham Breach27-Apr-11 12:06
Graham Breach27-Apr-11 12:06 
GeneralRe: Dynamics CRM 2011 - Cutomizing datetime picker in CRM Form Pin
phil.o27-Apr-11 20:39
professionalphil.o27-Apr-11 20:39 
Questionjquery ajaxupload Pin
dbongs25-Apr-11 23:46
dbongs25-Apr-11 23:46 
AnswerRe: jquery ajaxupload Pin
Monjurul Habib27-Apr-11 9:42
professionalMonjurul Habib27-Apr-11 9:42 
Questioncalander Pin
amit.veterans23-Apr-11 21:28
amit.veterans23-Apr-11 21:28 
AnswerRe: calander Pin
thatraja24-Apr-11 18:06
professionalthatraja24-Apr-11 18:06 
AnswerRe: calander Pin
RakeshMeena9-Jun-11 19:36
RakeshMeena9-Jun-11 19:36 
QuestionAll code on one line? Pin
#realJSOP23-Apr-11 1:04
mve#realJSOP23-Apr-11 1:04 
AnswerRe: All code on one line? Pin
Not Active23-Apr-11 3:12
mentorNot Active23-Apr-11 3:12 
GeneralRe: All code on one line? Pin
#realJSOP23-Apr-11 3:37
mve#realJSOP23-Apr-11 3:37 
GeneralRe: All code on one line? Pin
Not Active23-Apr-11 4:36
mentorNot Active23-Apr-11 4:36 
AnswerRe: All code on one line? Pin
RakeshMeena9-Jun-11 19:44
RakeshMeena9-Jun-11 19:44 
QuestionBrowse for folder Pin
krutikaji22-Apr-11 7:40
krutikaji22-Apr-11 7:40 
AnswerRe: Browse for folder Pin
Not Active22-Apr-11 8:58
mentorNot Active22-Apr-11 8:58 
Questionajaxupload [modified] Pin
dbongs21-Apr-11 0:23
dbongs21-Apr-11 0:23 
AnswerRe: ajaxupload Pin
Not Active21-Apr-11 2:12
mentorNot Active21-Apr-11 2:12 
Questionjquery grid paging and textbox event Pin
fififlowertot17-Apr-11 23:03
fififlowertot17-Apr-11 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.