Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

populate textfields by datefield

Avatar

Level 5

Hi All.

In my LiveCycle form 3 textfields and 1 datefield. I would like to populate textfields by value from datefield with display format "MM/DD". Each textfield will display date increased by 7 days. For instance, user will select date in datefield like 03/05/2018. In that case

textfield1 will display 03/12,

textfield2 will display 03/19,

textfield3 will display 03/26.

If that is possible. How do that? I will appreciate to detail explanation.

Thanks.

4 Replies

Avatar

Level 7

Hi,

Date calculations have alway been a bit of a pain to me, fortunately i have never had to do it much.

So when i got it working, i noted it down. It isnt quite what you are after, but will give you a starting point.

I have two text fields, Start_Date and End_Date.

In the Start_Date exit event (FormCalc) i have this:

form1.#subform[0].Start_Date::exit - (FormCalc, client)

var current = Date2Num(Start_Date.rawValue, "MM/DD/YY")

var future = current + 90

var newDate = Num2Date(future,"MM/DD/YY")

End_Date.rawValue = newDate

What is does is upon exiting the Start_Date field, the End_Date field gets a value which is 90 days into the future. Perhaps you can modify it for your needs.

Avatar

Level 5

Does possible to calculate date in javascript?

Thanks.

Avatar

Level 7

Hi,

I am note sure that Javascript handles date calculations

1436298_pastedImage_0.png

When i have had to mix and match code, i put the code in a hidden button to separate the code and programmatically click it.

Avatar

Level 7

it is possible to calculate date fields with JS however it is much more complex. Stick with FormCalc for ease of use.