Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How do I populate a date field with todays date when the signature field is signed?

Avatar

Level 2

How do I populate a date field with todays date when the signature field is signed? In LCD I insert a signature field and a date field, what settings in these two fields are required to make this work? Is the date field set to calculated? I tried different JS suggestions I found but none work. In the form I named the signature field ClaimSignature and the date field ClaimSigDate.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Figured it out with a little help. In the script editor window I chose the postSign event and added the following JS:

  form1.page1.ClaimSignature::postSign - (JavaScript, client)

var date = new Date();

var day = date.getDate();

var month = date.getMonth() + 1;

var monthstring = (month , 10 ? "0" + month : month)

var year = date.getFullYear();

var datestring = year + "-" + monthString + "-" + (day < 10 ? "0" + day : day);

ClsimSigDate.rawValue = dateString;

Hope this helps someone else save time.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Figured it out with a little help. In the script editor window I chose the postSign event and added the following JS:

  form1.page1.ClaimSignature::postSign - (JavaScript, client)

var date = new Date();

var day = date.getDate();

var month = date.getMonth() + 1;

var monthstring = (month , 10 ? "0" + month : month)

var year = date.getFullYear();

var datestring = year + "-" + monthString + "-" + (day < 10 ? "0" + day : day);

ClsimSigDate.rawValue = dateString;

Hope this helps someone else save time.