AnsweredAssumed Answered

Form button to populate Approved By and Approved On fields

Question asked by nhurst1369 on Mar 26, 2016
Latest reply on Mar 28, 2016 by nhurst1369

I need to add a button to a form that will populate a Approved By field with the Current User's Preferred Name, and a Approved On field with the Current Date.  For simplicity I made both Approved By and Approved On fields single line of text fields.

 

So far I've tried to add a Custom Javascript function, but two problems occur for me.  One is I can't figure out how to return the current users name, I can return a text value successfully like in the example below is about all.  Two is for the date, the current date returns a long line of numbers instead of the formatted date for some reason?  So this function:

function ApprovedFunction()

{

NWF$('#' + idApprovedBy).val("Current User Name here");

NWF$('#' + idApprovedOn).val(fn-FormatDate(Current Date, 'MM/dd/yyyy'));

}

**Returns these values:
Approved-By-Example-16-1.jpg

Does anyone have any ideas on how to make this work?  Thanks. 

Outcomes