Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Set Instances back to default

Avatar

Level 7

What wrong with the script below on click event?

Reset data but does not reset the instances back to one.

when there are more than one instances which is the default.

Thank you

 

var cResponse = app.alert({

    cMsg: "Do you really want to reset the form?\rAll data will be lost!",

    nIcon: 2, nType: 2, 

    cTitle: "Reset Form"});

// clear form only if response is "OK"

if (cResponse == 4) {

    xfa.host.resetData();

    xfa.form.remerge();

  

    }

   

   form1.page1.employeeInfo.Section1._KeyObjectives_Sub.setInstances(1);

2 Replies

Avatar

Level 6

resetData() - only resets the data entered/updated on the fields to default values.

The above code works fine with the a small change in steps sequence.

call "form1.page1.employeeInfo.Section1._KeyObjectives_Sub.setInstances(1);" code before "xfa.form.remerge();" line. After remerge(), unable to get the the subform it self, so it never executes "setInstances" method, you can check this by placing try/catch block with the existing code.

For more details and another way of doing the same functionality, check the thread here: http://forums.adobe.com/thread/836420

Hope this helps.

Avatar

Level 7

Thank you for your help.

Works perfect!

Thank you