Skip to main content
Inspiring
July 25, 2023
Answered

reset form buttons

  • July 25, 2023
  • 1 reply
  • 946 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
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
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);
Inspiring
August 4, 2023

Thank you Nesa! Awesome!!