Yes, see here:
https://github.com/nuBuilder/nuBuilder- ... g_activity
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Add Record Creator to New Record
Re: Add Record Creator to New Record
Thanks Kev1n, hope you or another of the team can add this to the code library as it is a very useful and easy to solution.
Re: Add Record Creator to New Record
Hi kev1n,
I looked at the link and not sure where some of the code goes.
I added the following to the header
But where does the next block go?
I tried the form's custom code and listed it as an onclick event but it doesn't seem to work.
I looked at the link and not sure where some of the code goes.
I added the following to the header
Code: Select all
function formatUnixDateTime(t, locales, dOptions, tOptions) {
if (typeof dOptions === 'undefined') {
var dOptions = {};
}
if (typeof tOptions === 'undefined') {
var tOptions = {};
}
var d = new Date(t * 1000);
return d.toLocaleDateString(locales, dOptions) + ' ' + d.toLocaleTimeString(locales, tOptions);
}
function getNuLogData(obj, type, what) {
var undef = (typeof obj === 'undefined');
var info = '<b>' + nuTranslate(type + ' ' + what) + ':</b> ';
if (what == 'User') {
return undef ? '' : info + obj.user + "<br>";
} else
if (what == 'Time') {
return undef ? '' : info + formatUnixDateTime(obj.time, "en-US") + "<br>";
}
}
Code: Select all
function showNuLogInfo(id) {
var nuLog = $('#' + id).val();
var obj = JSON.parse(nuLog);
var msg = getNuLogData(obj.added, 'Added', 'User') + getNuLogData(obj.added, 'Added', 'Time');
msg += getNuLogData(obj.viewed, 'Viewed', 'User') + getNuLogData(obj.viewed, 'Viewed', 'Time');
msg += getNuLogData(obj.edited, 'Edited', 'User') + getNuLogData(obj.edited, 'Edited', 'Time');
nuMessage([msg]);
$('#nuMessageDiv').css('text-align', 'left');
}
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Add Record Creator to New Record
showNuLogInfo() can also be added to the Header.
Then call the function like this (replace example_nulog with you nulog object Id that has to be on the form)
Then call the function like this (replace example_nulog with you nulog object Id that has to be on the form)
Code: Select all
showNuLogInfo('example_nulog');