Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Reset validation on a new instance of a subform

Avatar

Former Community Member
Hi,



I am using LiveCycle ES 8.2,



I have a request form. It contains 5 fields in a subform. (3 text fields, 2 sets of radio buttons). At the bottom of the form the user has an option to add another request by way of a button. The user clicks the botton and validation code checks the form to confirm the user has filled in or checked all the fields. If the user did then a new subform appears with the same 5 fields blank. The problem is, if the user clicks the button again no validation takes place. I think, this is because the validation code is checking the first 5 again and sees the fields filled in so it naturally spits out another set of 5.



So the user has 15 fields and only the first 5 are complete while the last 10 are blank because the validation did not reset itself.



What or how do I get the validation to reset itself?



Here is a sample of the code I am using.



var iVar = 0;



if ((examplesubform.exampletextfield.rawvalue == null) || (examplesubform.exampletextfield.rawvalue == "")

{

xfa.resolvenode("examplesubform.exampletextfield.ui.#textedit.border.fill.color").value = "255,0,0";

app.alert("you must provide an example");

iVar = 1;

}

else

{

xfa.resolvenode("examplesubform.exampletextfield.ui.#textedit.border.fill.color").value = "255,255,255";



if (iVar == 0)

{

examplesubform.instanceManager.addInstance(true);

xfa.form.recalculate(true);

}



I know enough to be dangerous but not enough to get out of trouble. Any advise or help would be greatly appreciated.



thanks
1 Reply

Avatar

Level 4
execValidate() is the command you are looking for.



this.parent.execValidate(); will validate every field in the form that is containing the button you are clicking.



If you wanted to target a specific instance of a form then you would use:



RepeatedFormName.all.item(InstanceNumberVariable).execValidate();