Skip to main content
Participant
May 30, 2018 3:57 PM UTC
Answered

Form - Button inserts username and date

Hello,

I'm creating a form that includes a button that will automatically enter in the users Windows ID and current date and I'm having trouble finding a javascript on how to do this.

Any help that could be provide would be greatly appreciated.

Thanks,

Nathan

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
May 30, 2018 6:37 PM UTC

First thing to know is that it's JavaScript, not Java. Similar names, but very different languages.

You can use this code:

this.getField("Date").value = util.printd("mm/dd/yyyy", new Date());

8 replies

try67
Community Expert
Community Expert
May 30, 2018 4:06 PM UTC

The latter is easily done, the former not so much. You can access the "Login Name" property of the identity object, but it requires installing a script on the user's local machine.

Translate
NathanDFAuthor
Participant
May 30, 2018 5:26 PM UTC

Thanks. Any advise on how to do the date? This is the first form I'm creating with a button and I'm not too savvy with Java.

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 30, 2018 6:37 PM UTC

First thing to know is that it's JavaScript, not Java. Similar names, but very different languages.

You can use this code:

this.getField("Date").value = util.printd("mm/dd/yyyy", new Date());

Translate