Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

submit a form with a hidden mandatory fields without any value

Avatar

Level 7

How I can submit a form with a hidden mandatory fields without any value?

when I try to submit the form still ask me for mandatory fields to fill.

Hidden mandatory fields become visible if a condition is met.

Any sample to avoid this problem?

Thank you

3 Replies

Avatar

Level 4

Try setting the presence to Inactive.  See:http://blogs.adobe.com/formfeed/2009/03/xfa_30_presenceinactive.html.

I see that this is not properly documented in the help.  I'll log a bug.

Avatar

Level 7

I would set the condition to flag the fields as mandatory if they are met. otherwise, it shouldn't be mandatory since it is hidden.

For example:

if (textField1.rawValue == "no"){

   this.parent.textField2.presence="hidden";

   this.parent.textField2.mandatory="disable";

}

else {

   this.parent.textField2.presence="visible";

   this.parent.textField2.mandatory="error";

   this.parent.textField2.mandatoryMessage="This is required.";

}

Message was edited by: jasotastic81--corrected the code

Avatar

Level 7

Thanks very much for your help.

A question:

what this mean: "no"

I suppose the correct is:

textField2.rawValue == "no

not

textField1.rawValue == "no