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.
SOLVED

Best way to reset all form fields EXCEPT for 1

Avatar

Level 4

Hi, I have a button with this on the click event:

xfa.host.resetData();

However, there's one field that related to form mechanics and not the user interface that calculates a number of days.  I want that calculation to remain after resetting all form fields.  How can I most efficiently do this?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

One workaround is to declare a variable with the value of the particular field. Then reset the form. Then reassign the particular field with the variable:

var vField = TextField1.rawValue;

xfa.host.resetData();

TextField1.rawValue = vField;

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Level 4

I'm guessing that a for loop will do the trick.  For any field that is "open", reset.  My Calcuated field is "readOnly".  I'll implement this and post my results.

Edit: actually, since my calculated field is on its own page (no user input there) I'll make my loop apply for any field not on that page.

Avatar

Correct answer by
Level 10

Hi,

One workaround is to declare a variable with the value of the particular field. Then reset the form. Then reassign the particular field with the variable:

var vField = TextField1.rawValue;

xfa.host.resetData();

TextField1.rawValue = vField;

Hope that helps,

Niall

Avatar

Level 4

That worked perfectly, and was much simpler than the solution I was envisioning.  Thanks!