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

Efficient Approach to Reset Multiple Objects in Adobe Designer Based on Dropdown Selection

Avatar

Level 3

Hello,

 

I am currently working on designing a PDF form using Adobe Designer, where I have implemented a dropdown menu. Upon selecting an option from this dropdown, certain objects appear, allowing users to input information.

 

Screenshot from a demo form (after selecting value from the dropdown)

 

0experience_0-1701882461308.png

After giving input

 

0experience_1-1701882515397.png

Now, if I select "No" from the dropdown menu all of these objects will be hidden. Again if I select the "Yes" option from dropdown then all objects will be pop up again with the value I gave previously. 

 

Is their any efficient way to reset data for all object those appear based on "Yes" (and I provided data) while I will select "No"? I know I can use "rawValue" properties individually to reset them but this is a not very practical for my actual form which contains a lot of objects.

 

Thank you

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

I would wrap all fields that you want to reset in a subform.

Using the resetData() put the full path to the subform in the (). Ex. xfa.resetData("xfa.form.form1.Page1.sfResetFields"); That will do it for all fields in the subform.

You can also control the access to all the fields by setting the subform access = "protected". Ex. xfa.form.form1.Page1.sfResetFields.access = "protected";

When you want the user to be able to access all the fields in the subform just call the .access and set it = "open" instead of "protected".

View solution in original post

10 Replies

Avatar

Community Advisor

resetData will reset all the form fields. 

To reset data for a few fields in the form, you can create an array of fields and then pass that array to a function and set data to null for each field by traversing the array.

This will help you write less code.

Avatar

Correct answer by
Level 3

I would wrap all fields that you want to reset in a subform.

Using the resetData() put the full path to the subform in the (). Ex. xfa.resetData("xfa.form.form1.Page1.sfResetFields"); That will do it for all fields in the subform.

You can also control the access to all the fields by setting the subform access = "protected". Ex. xfa.form.form1.Page1.sfResetFields.access = "protected";

When you want the user to be able to access all the fields in the subform just call the .access and set it = "open" instead of "protected".

Avatar

Level 3

@koolForms thanks, I really wanted something like this. Thanks again.

 

Well, I can reset using the reset function. However, can we pass a subform inside the remerge function too? 

Actually, after reset I also need to remerge the subform. I am trying to use the

 

xfa.form.remerge("subform_address");

 

 

but getting

 

 

Incorrect number of parameters calling method 'remerge' error 

 

 

I know, we can't pass string inside of remerge function.

 

Any ideas are appreciated. 

Avatar

Level 3

I want to get the subform in the initial state (like we use remerge on the form to get the initial state of the form).

Avatar

Level 3

xfa.form.remerge() does not have any parameters. Per the Adobe documentation: Forces the remerging of the data model and template model to re-create the form model.

If you want to reset fields to empty you can use the resetData(). If you want to hide or show then you should use specific .presence for each subform or object that needs control based on that specific user input.

Avatar

Administrator

@0experience Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Level 3

@kautuk_sahni I don't see any options to accept answer (I am not sure, maybe it is because the question has been posted in the Discussion group).

Avatar

Administrator

@0experience I have moved this to the question group. You can mark the Question correct now. Please do the needful. Thank you for your proactiveness. 



Kautuk Sahni