Expand my Community achievements bar.

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
Former Community Member

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
Former Community Member

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

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----