Skip to main content
Inspiring
July 25, 2023
Answered

reset form buttons

  • July 25, 2023
  • 1 reply
  • 933 views

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!

This topic has been closed for replies.
Correct answer Nesa Nurani

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);

1 reply

Nesa Nurani
Nesa NuraniCorrect answer
Inspiring
July 25, 2023

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);
New Participant
June 28, 2024

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:

 

Nesa Nurani
Inspiring
June 28, 2024

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.