Expand my Community achievements bar.

How to validate specific fields from multiple subforms before printing?

Avatar

Former Community Member

Hi,

Is it possible to add validations in a form with 3 checkboxes before printing and each checkbox gives other textfields(subforms), you can only check one box at the time.

When I tried to validate, it checks all the textfields from each checkbox. I want to validate only the textfields of the box I have checked.

So far, I can validate all the textfields and not independently from each checkbox.

This part is for the printing:

<event activity="prePrint" ref="$host" name="event__prePrint">

            <script contentType="application/x-javascript">

if (

(xfa.resolveNode("TextField2").rawValue == null) ||

(xfa.resolveNode("TextField3").rawValue == null)

)

{

app.alert("Please fill in all the fields.",3);

xfa.event.cancelAction = true; // cancel printing

app.runtimeHighlight = true;

if (xfa.resolveNode("TextField2").rawValue == null)

{

xfa.resolveNode("TextField2").fillColor = "000,159,218";

}

if (xfa.resolveNode("TextField3").rawValue == null)

{

xfa.resolveNode("TextField3").fillColor = "000,159,218";

}

}

else

{

xfa.event.cancelAction = false; // proceed with printing

}

</script>

         </event>

I'm a beginner and I hope someon could help me with this. Thanks!

0 Replies