These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Button that sets todays date in LiveCycle

brennanhobart
Registered: Oct 9 2007
Posts: 37
Answered

I have a LiveCycle form that has a simple button that I want to add some javascript that sets the date of another field when it's clicked. I figured it would look somehting like this below:
 
TechValue.WorkFlow.TCStartDate.value = "start";
 
TCStartDate is the name of the date field and I'm not sure what to enter in .value = ""; that would set in todays date when useres click the button.
 
Has anyone else dont this?
  

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
Hi,

I prefer FormCalc instead JavaScript for date and time functions, as it much easier to handle.

This script will populate the field TCStartDate with the current date:
TechValue.WorkFlow.TCStartDate = Num2Date(date(), "DD.MM.YYYY")

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

brennanhobart
Registered: Oct 9 2007
Posts: 37
Radzmar: Thanks for the answer. Your script worked perfect. I added in the name of the table .WorkTable and the row .Row1 where the text field TCStartDate resided in the hierarchy. I set the text field TCStartDate to read only and it worked great. Here's what the final formcal script looked like in the mouse up event of the normal button.

//TechValue.WorkFlow.WorkTable.Row1.TCButton::mouseUp - (FormCalc, client)
TechValue.WorkFlow.WorkTable.Row1.TCStartDate = Num2Date(date(),"DD.MM.YYYY");