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

How to reset an entire form if a text field changes


Level 1


I have  a fillable and very long form designed in livecycle.

What I want is, if a user changes a certain field (lets say it Field 1);

1- All other fields values should become blank.

2- All fields on the form which are hidden in default but made visible by some actions of the user, to become hidden again.

I found a way doing this in Field 1's change event with this code:



This actually works. After changing Field 1, all other fields contents are erased and the previously hidden fields become hidden again.

But there is a frustrating issue:

Users should enter a ten digit number in Field1. When entering numbers, after every key stroke, a process started (clock sign shows) and it lasts approx. one second. After it ends, a beep also sounds. If you do not wait the process to end after every key stroke and rapidly press 10 keys continuously, system can not get all the numbers and misses some of them.

So to pass this issue, I have decided to change the place of the code to Field 1's exit event.

But in this event type, I experienced two other problems:

1- If user just clicks to Field 1, changes nothing and than clicks to any another place (exit) the form resets.

2- If a user changes Field 1, the field itself also resets. (In the change event, the field itself does not reset)

So after this, I made a little research on the web and figured out this code:

if (xfa.event.newText != xfa.event.prevText) {




I want to make the system check if the content changed at the exit. I used in Field 1's exit event.

But it does not work.

What did I do wrong?

0 Replies