Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Date Calculation Field

Avatar

Level 1
My form contains a field which the end-user selects a date from a popup calendar. With the date selected I would like to add 90 days to it and post it in another field. Does anyone have an idea how to complete this task? Any help would be appreciated.
5 Replies

Avatar

Level 5
Here is simple FormCalc code which I used in the past. Try with 'change' or 'exit' events of the date that allows user to select.



var givenDate

givenDate = $.rawValue



xfa.form.formname.subformname.Dateafter90.rawValue = Num2Date((givenDate + 90), "MMM DD, YYYY")



Good luck,

SekharN.

Avatar

Level 1
Thanks for your help, but I still don't seem to understand how to do this. I have placed this code on my field that the end-user selects the date. And have named this field givenDate. My other field that I want the date + 90 I have named "Dateafter90". If you could provide a little more help I would appreciate it. I am a novice and this is a little over my head.

Avatar

Level 5
shoot me an email with attaching a copy of your form at meetsekharv@yahoo.com



Thanks,

SekharN.

Avatar

Level 1

Is there a way that you can post the solution??

Thanks!

Avatar

Level 6

Here's another option.  FormCalc:

if (StartDate.rawValue==null) then

$.rawValue = ""

else

Num2Date(Date2Num(StartDate.formattedValue, DateFmt(2))  + 90, DateFmt(2))

endif