Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Required Hidden Fields???

Avatar

Level 1

I am in the process of creating a form consisting of many fields as an in-processing form for my job. The issue is that every field needs to be required but when they are hidden they are still reading as required. How would I keep conditional logic and make only the fields that are not hidden required?

4 Replies

Avatar

Former Community Member

In the code that hides those fields, add TextField1.mandatory = "disabled";

Avatar

Level 1

Steve,

How would that fit in here:

if ($.boundItem(xfa.event.newText) == "CIV" || $.boundItem(xfa.event.newText) == "MIL" || $.boundItem(xfa.event.newText)

     this.resolveNode ("Government").presence = "visible";

     this.resolve.Node("Contractor").presence= "invisible";

}

Avatar

Level 9

Hi,

Lets say you are making the field "Contractor" as inviisble. So you can append the code Contractor.mandatory = "disabled".

If you want more dynamic code you have to first check the visibilty of the field. If the field is vivible make it madatory and if the field is hidden make it optional.

Thanks,

Bibhu.

Avatar

Former Community Member

if ($.boundItem(xfa.event.newText) == "CIV" || $.boundItem(xfa.event.newText) == "MIL" || $.boundItem(xfa.event.newText)

     this.resolveNode ("Government").presence = "visible";

     this.resolve.Node("Contractor").presence= "invisible";

     this.resolve.Node("Contractor").mandatory = "disabled";

}

Although I would think this would work:

if ($.boundItem(xfa.event.newText) == "CIV" || $.boundItem(xfa.event.newText) == "MIL" || $.boundItem(xfa.event.newText)

     Government.presence = "visible";

     Contractor.presence= "invisible";

     Contractor.mandatory = "disabled";

}