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)
After giving input
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
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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".
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.
@Vijay_Katoch thanks, that works.
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".
@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.
What are you wanting to accomplish by remerging?
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).
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.
@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.
Views
Replies
Total Likes
@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).
@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.
Views
Replies
Total Likes
Views
Likes
Replies