Resetting the values of the current subform

This example demonstrates how to reset the values of a specific set of fields, not the whole form. To do this, reset only the fields in the required subform object.

In this example, the form filler can click the Clear button to reset the field values.

To see this scripting example and others, visit visit the LiveCycle Developer Center.

Scripting for the values that appear in the left column

Type this script for the values appearing in the left column:

    this.rawValue = this.parent.index + 1;

To reset the default values add a click event to the Clear button. You need a dynamic reference syntax expression because the detail is a repeating subform and must be reflected in the reference syntax expression. In this situation, it is easier to build the resetData parameters separately.

    var f1 = this.parent.somExpression + ".TextField2" + ","; 
    var f2 = f1 + this.parent.somExpression + ".DropDownList1" + ","; 
    var f3 = f2 + this.parent.somExpression + ".NumericField1"; 
     
    // ...and pass the variable as a parameter. 
    xfa.host.resetData(f3);

// Ethnio survey code removed