Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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?

0 Replies

Avatar

Level 6

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

Level 6

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";

}