Page 1 of 1

Pre Populating a date field

Posted: 26 Apr 2017
by jpwallace
Hi guys,

I have got my form to pre populate the logged on user using...
// Load current user login
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
// Set user login
fd.field('Customer').control().value(user.get_loginName());
// Run validation by emulating validation image click
fd.field('Customer').control()._el().find('a:eq(0)').click();
});
}), "SP.js");

This works fine, is there a similar script to populate a date field, I have tried in SP list settings and set "Todays Date" as the default but it just shows up as a blank field??

Cheers

John

Re: Pre Populating a date field

Posted: 26 Apr 2017
by Dmitry Kozlov