Avatar

Level 3

Hi everyone,

I have a form with custom validation. If the user checks a box a subform becomes visible. Only when that subform is visible a couple of its fields should be treated a required. I was able to achieve that with the script below except that all validation is triggered for that subform at the same time. I would prefer one error at a time. So if vendor1 is null the prompt alerts the user, highlights and focus on that field and no other required alerts should come up. How do I stop the validation after the first null error is triggered?

Validate Event of vendor1:

if (comparativeBids.presence == "visible" && this.rawValue == null) {

    app.alert("Please enter a vendor name on line 1 of the Comparative Analysis section.")

    this.fillColor = "255,232,230";

    xfa.host.setFocus(this);

    false;

  }

Validate Event of vendor2:

if (comparativeBids.presence == "visible" && this.rawValue == null) {

    app.alert("Please enter a vendor name on line 2 of the Comparative Analysis section.")

    this.fillColor = "255,232,230";

    xfa.host.setFocus(this);

    false;

  }

etc.