Expand my Community achievements bar.

Reset Data

Avatar

Former Community Member
I do not want to reset the entire form using the Reset Button. If i have a 3 page form for example. Is there a simple JavaScript code to reset say all fields on Page 1 or would I have to list them separately to null?



Thanks
5 Replies

Avatar

Level 7
Look at creating a button and using the:



$host.resetData

This method resets field values on a form.



Syntax

$host.resetData([ STRING param ])



Parameters

Parameter Description

param

(optional)

Optional list (separated by commas) of the names of all fields to reset. If not present or empty, all the fields in the form are reset to their default value.



Returns

Empty

Avatar

Level 5
xfa.host.resetData("topmostSubform.Page4");

This will reset all of the fields, but only those on Page4.

Avatar

Former Community Member
Thanks Mark,

but it still resets the entire form....any other solutions?

Avatar

Level 5
You need to be sure that the part in quotes EXACTLY matches your document structure. If it does not, it will ignore the text, and result in a wildcard execution "()" that resets the whole form.

Is the Hierarchy of your form:



topmostSubform

Page1

Page2

Page3

Page4



Or are other names in use?

Avatar

Former Community Member
Got it to work now....my pages were in parenthesis

ex.(untitled subform)(page 1), so i renamed it to Page 1 etc. and it worked.



Thank you