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.

Reset Button Exclusion

Avatar

Level 4
Designer 7.0 provides this JavaScript code automatically when you choose the standard 'reset button' from the Library -- xfa.host.resetData();



The Calculations & Scripts manual indicates you can add the fields, separated by commas, of all the fields to be reset (included). Is there a way to just list the fields to be excluded instead? I only want to exclude 1 field in a form containing over 50 fields. If I understand the manual correctly, I must enter 49 field names in the parameter so I can exclude just one field. There has got to be a better way (I hope!!).



Please help!
6 Replies

Avatar

Former Community Member
In this case, you don't want to use the reset button.

Just use a regular button and attach the javascript to it that will clear the only field that you want.



Ex: put this javascript on the "click" event of your button.



yourClearedField.rawValue = null;

Avatar

Level 4
Major apologies. I didn't explain what I wanted clearly enough. I'll attempt it again.



In a form of 50 fields, 49 fields should be cleared when the RESET button is clicked.



The 50th field should be excluded from the reset action.

Avatar

Former Community Member
As far as I know this is not possible. You either give all the fields you wish to reset or you select all.



However, you could try something simple like a naming convention to fields (start with a prefix) and then with a little scripting loop through all objects within a container (i.e. subform) and add them to the list of fields to be reset. Instead of you adding them, let the script to the work. Just an Idea

Avatar

Former Community Member
You can try to introduce a form document variable and use it as temporary storage that store the data for the field that you don't want to reset. You can then re-assign the value back to that form field after your call the xfa.host.reset() method.




Here is an example.

Avatar

Former Community Member

The link to the example doesn't work anymore.  Can you assist me with this?  I am trying to do the same thing.  I would like to clear the field for all but one field.

Thanks!

Jennifer

Avatar

Level 4
Jimmy.... you rock!!! <br /><br />This worked perfectly (although it took me a while to find the 'hidden' piece of the puzzle -- big pride here for finding it <g>)!<br /><br />Thanks so much.