Expand my Community achievements bar.

What else must I do to force data entry other than making the field required in LC 9 Forms Designer?

Avatar

Former Community Member

I am trying to make sure that fields are populated with data prior to moving to the next field, but it seems that simply making the field required is not sufficient.  What else must I do to enforce data entry within required fileds?

Thank you,

1 Reply

Avatar

Former Community Member

There are a variety of scripting techniques that can be used based upon the form requirements, UI aesthetics, designer preference,... The script below forces data entry into a text field object called 'tf1' but it is a dangerous practice and should be used carefully. You may find yourself in a infinite loop based upon the tab order. A safer pattern includes global field validation upon submit.

// form1.page1.subform1.tf1::exit - (JavaScript, client)


if (this.isNull) {

  xfa.host.messageBox("tf1 is a mandatory field.","Text Field 1 Error",0);

  xfa.host.setFocus("form1.page1.subform1.tf1");

}

Steve