Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Storing a Date/Time

Avatar

Level 3

I have a date/time field called SubmitDate. I'm trying to store the date/time into that field, just before saving the form. For some reason this JS is not working.

SubmitDate.rawValue = Date.getDate();

app.execMenuItem("SaveAs");

app.launchURL("http://Adobe.com");

Am I doing something wrong?

1 Accepted Solution

Avatar

Correct answer by
Level 10

You haven't defined what Date is. I think you want o do somethig like this:

var nDate = new Date();

SubmitDate.rawValue = nDate.getDate();

After this code runs the value of the current day (an integer between 1-31) will be placed in the SubmitDate field. For today it woudl return 6.

Note that this is standard javascript and has nothing to do with  the form. The only part that is unique to the form is the assignment statement to SubmitDate.

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

You haven't defined what Date is. I think you want o do somethig like this:

var nDate = new Date();

SubmitDate.rawValue = nDate.getDate();

After this code runs the value of the current day (an integer between 1-31) will be placed in the SubmitDate field. For today it woudl return 6.

Note that this is standard javascript and has nothing to do with  the form. The only part that is unique to the form is the assignment statement to SubmitDate.

Paul

Avatar

Level 3

Thank you for this explanation -- that helps.

Since I have a Date/Time field (SubmitDate) in my form, how would I populate that with the current date and time?

Avatar

Level 10

submitDate.rawValue = Date()

or you can use the Current Date and Time Object in teh Custom library palette. This using FormCalc to get the current Date but you end up with the same thing.

Paul