Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Livecycle Javascript question

Avatar

Level 2

Created a Form in Livecycle. The user inputs a six digit reference into a text field which is required for input in other text fileds in the Form. What is the Javascript that could do this?

6 Replies

Avatar

Level 7

You can use binding to make the value of all the fields the same, you could store the value of the first field in a global variable, or you can use code such as:

this.rawValue = textField1.rawValue

to make other fields match the value of the first one.

Avatar

Level 2

Thank you. Just started working with Livecycle and done nothing beyond trying to set form layouts. Used the Binding tab and selected global variable and it worked. I assume global variable just applies to the current Form? Tried to use: this.rawValue = textField1.rawValue in the script editor with the change event but it did not work. Would prefer to use this script, what did I do wrong?

Avatar

Level 7

You can either put this.rawValue = textField1.rawValue in the layoutReady event of the field you want to match textField1 or in the exit event of textField1 put textField2.rawValue = this.rawValue. (obviously changing the names to what you have called your textfields)

Avatar

Level 2

Thank you, but I still have one problem. I enter the value in textField1 and when I exit the field the same value now diplays in textField2. TextField2 is in a repeatable subForm and whilst the value diplays in every created instance, when I merge data into a spreadsheet only the first instance appears in the caputed data. Do I need to do something else? 

Avatar

Level 7

It might be to do with the binding. Fields that are bound to other fields dont export. You might have to turn off the binding and use scripting instead.

Avatar

Level 2

Is there much involved in scripting to pickup the value of textField1 to populate a repeatable textFeld2?