Get Date and Time
Good Morning,
We have an edit form with a number of fields that do not need to be edited by a user and that we want to display in a more user friendly way.
Two of these fields are as follows
Call Taken by - Single Client People Picker
Time Logged - Date & Time field
I have placed a HTML field on the form with the following code:
And then in JavaScript added the following function and called the function to run on Form Load: -
None of the above seems to work, I already have a forum post for the "Call Taken by" field, but equally I cannot get the values of the "Time Logged" field either.
This is on an edit form, but I will also need to use this on a display form to display the same information to the user.
Any help much appreciated.
We have an edit form with a number of fields that do not need to be edited by a user and that we want to display in a more user friendly way.
Two of these fields are as follows
Call Taken by - Single Client People Picker
Time Logged - Date & Time field
I have placed a HTML field on the form with the following code:
Code: Select all
<div id="callTakerDetails" style="white-space:nowrap;"></div>
Code: Select all
// Sets the Call Taker Display Field
function setCallTakerDisplay () {
var callTaker = fd.field('Call_x0020_Taken_x0020_By').value().dictionaryEntries[0].AccountName;
var dateLogged = fd.field('Time_x0020_Logged').value()[0];
var hourLogged = fd.field('Time_x0020_Logged').value()[1];
var minLogged = fd.field('Time_x0020_Logged').value()[2];
$("#callTakerDetails").html('<p style="font-size:14px; color:#4F81BD;"><b>Call Taken by - </b>' + callTaker + ' on ' + dateLogged + ' at ' + hourLogged + ':' + minLogged +'</p>');
}
This is on an edit form, but I will also need to use this on a display form to display the same information to the user.
Any help much appreciated.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Tony!
Your code worked just fine for me, at least the time setting part that I've tested.
Make sure that the field name is indeed correct and don't forget to call this function after declaring it:
As for Display form, you will need custom form for it, because this:
will return you a string of Date and Time, like this - "11/23/2017 1:35 PM"
Your code worked just fine for me, at least the time setting part that I've tested.
Make sure that the field name is indeed correct and don't forget to call this function after declaring it:
Code: Select all
function setCallTakerDisplay () {
//your function
}
setCallTakerDisplay();
Code: Select all
fd.field('Time_x0020_Logged').value();
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests