Copy link to clipboard
Copied
Currently using a reset form button that resets entire form (several hundred fields spread across multiple pages). I would like to be able to optionally retain the data in certain fields while similtaneously resetting the form. Possible? These certain fields I want to retain also have same-named duplicate fields throughout the form (and spawned pages) whose data would also need to be optionally retained. Could a second button then be used to optionally reset only the certain fields whose data was retained? Thanks in advance for guidance!
Copy link to clipboard
Copied
Use this and put fields names which you don't want to reset in 'notReset' variable:
var notReset = ["Field1","Field2","Field3"];
var resetFields = [];
for (var i=0; i<this.numFields; i++){
var fname = this.getNthFieldName(i);
if (notReset.indexOf(fname)!=-1) continue;
resetFields.push(fname); }
this.resetForm(resetFields);
Copy link to clipboard
Copied
Use this and put fields names which you don't want to reset in 'notReset' variable:
var notReset = ["Field1","Field2","Field3"];
var resetFields = [];
for (var i=0; i<this.numFields; i++){
var fname = this.getNthFieldName(i);
if (notReset.indexOf(fname)!=-1) continue;
resetFields.push(fname); }
this.resetForm(resetFields);
Copy link to clipboard
Copied
Thank you Nesa! Awesome!!
Copy link to clipboard
Copied
This is similiar to a problem I'm trying to solve for - but how do you allow for an option to be included with the reset, or release the information to be reset?
Name:
Address: (be able to lock/unlock for reset)
Phone #: (be able to lock/unlock for reset)
Shoe size:
Favorite pizza toppings:
Copy link to clipboard
Copied
If you want to be able to select if specific fields should be reset or not, you could use 'response box' to load all specific fields names in question by default, then just remove names you don't want to reset, or with a series of alerts, or the more complex version custom dialog box with checkboxes to select which of the fields you wish to reset.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now